This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
imports = [
|
||||
./vanilla.nix
|
||||
./horizon.nix
|
||||
./create-aeronautics.nix
|
||||
./wow-mine-map.nix
|
||||
./world-of-sosal.nix
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# Horizon on neuro
|
||||
|
||||
Horizon Nightly 2026-11-01 serves Minecraft Java Edition 26.3 on TCP 25569.
|
||||
It runs without Java on neuro, uses `/var/lib/horizon`, and starts only when
|
||||
`/var/lib/horizon/resources/registries.json` exists. The whitelist is enabled;
|
||||
add an account with:
|
||||
|
||||
```sh
|
||||
sudo -u horizon horizon-server --dir /var/lib/horizon whitelist add PLAYER
|
||||
```
|
||||
|
||||
## Prepare resources
|
||||
|
||||
Horizon cannot redistribute Minecraft resources. On a computer with Minecraft
|
||||
26.3 installed and played once, Java 25, its `server.jar`, and this pinned
|
||||
Horizon package, prepare them locally:
|
||||
|
||||
```sh
|
||||
horizon-prepare --prepare \
|
||||
--server-jar /path/to/26.3/server.jar \
|
||||
--minecraft-dir /path/to/.minecraft \
|
||||
--output ./horizon-resources
|
||||
```
|
||||
|
||||
The packaged command seeds its pinned exporter support files into
|
||||
`$XDG_CACHE_HOME/horizon/prepare-root-nightly-2026-11-01` (or `~/.cache` when
|
||||
`XDG_CACHE_HOME` is unset). Bundled support files contain no Mojang data.
|
||||
Preparation imports your local game files into this writable root. Pass
|
||||
`--root PATH` to seed and use another writable location.
|
||||
|
||||
Copy the complete `horizon-resources` folder to neuro without changing its
|
||||
contents, then grant the service read access and explicitly restart it:
|
||||
|
||||
```sh
|
||||
sudo install -d -o horizon -g horizon -m 0750 /var/lib/horizon/resources
|
||||
sudo rsync -a --chown=horizon:horizon ./horizon-resources/ /var/lib/horizon/resources/
|
||||
sudo systemctl restart horizon
|
||||
```
|
||||
|
||||
If `registries.json` is absent, systemd leaves the unit skipped instead of
|
||||
crash-looping. `server.toml` and Horizon's `eula.txt` are copied to writable
|
||||
state on every start;
|
||||
declarative defaults remain authoritative while worlds, backups, whitelist,
|
||||
operators, bans, and other generated files persist under `/var/lib/horizon`.
|
||||
@@ -0,0 +1,83 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
horizon = pkgs.hectic.horizon;
|
||||
eulaFile = pkgs.writeText "horizon-eula.txt" ''
|
||||
eula=true
|
||||
'';
|
||||
serverConfig = pkgs.writeText "horizon-server.toml" ''
|
||||
[server]
|
||||
port = 25569
|
||||
online_mode = true
|
||||
whitelist = true
|
||||
|
||||
[world]
|
||||
name = "world"
|
||||
|
||||
[engine]
|
||||
path = "${horizon}/libexec/horizon/horizon-engine"
|
||||
resources = "/var/lib/horizon/resources"
|
||||
restart_on_crash = true
|
||||
|
||||
[backups]
|
||||
every = "6h"
|
||||
keep = 12
|
||||
|
||||
[panel]
|
||||
bind = ""
|
||||
allow_public = false
|
||||
|
||||
[api]
|
||||
bind = "127.0.0.1:8131"
|
||||
token = ""
|
||||
allow_public = false
|
||||
'';
|
||||
in {
|
||||
users.groups.horizon = {};
|
||||
users.users.horizon = {
|
||||
isSystemUser = true;
|
||||
group = "horizon";
|
||||
home = "/var/lib/horizon";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ horizon ];
|
||||
networking.firewall.allowedTCPPorts = [ 25569 ];
|
||||
|
||||
systemd.services.horizon = {
|
||||
description = "Horizon Minecraft server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
unitConfig.ConditionPathExists = "/var/lib/horizon/resources/registries.json";
|
||||
environment.HORIZON_NO_UPDATE_CHECK = "1";
|
||||
restartTriggers = [ serverConfig eulaFile ];
|
||||
preStart = ''
|
||||
install -m 0640 ${serverConfig} /var/lib/horizon/server.toml
|
||||
install -m 0640 ${eulaFile} /var/lib/horizon/eula.txt
|
||||
'';
|
||||
serviceConfig = {
|
||||
User = "horizon";
|
||||
Group = "horizon";
|
||||
WorkingDirectory = "/var/lib/horizon";
|
||||
ExecStart = "${horizon}/bin/horizon-server --dir /var/lib/horizon run";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 10;
|
||||
KillSignal = "SIGTERM";
|
||||
TimeoutStopSec = 180;
|
||||
StateDirectory = "horizon";
|
||||
StateDirectoryMode = "0750";
|
||||
UMask = "0027";
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictSUIDSGID = true;
|
||||
CapabilityBoundingSet = [ "" ];
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user