services: restart Minecraft after it exits on its own
All checks were successful
nixos / nixos (push) Successful in 28s

AutoUpdateGeyser restarts the server with /restart. Paper finds no
start script, stops and exits 0, and Restart=always should start it
again. The module binds the stdin socket to the service, though: the
exit stopped the socket, the socket's stop cancelled the restart, and
the server stayed down from 2026-11-17 16:01 until started by hand.

PartOf keeps the socket across an exit and still stops it with the
service. FlushPending already drops the "stop" ExecStop leaves in the
FIFO.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-11-18 12:49:38 +04:00
commit 55f3036574
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -28,6 +28,16 @@
pkgs.stdenv.cc.cc.lib
];
};
# AutoUpdateGeyser restarts the server with /restart; Paper finds no
# start script and exits 0, and systemd must start it again. The
# module binds the stdin socket to the service, so the exit stopped
# the socket and the socket's stop cancelled Restart=always. PartOf
# keeps the socket across an exit and still stops it with the service.
systemd.services.minecraft-server.serviceConfig.RestartSec = 10;
systemd.sockets.minecraft-server = {
bindsTo = lib.mkForce [ ];
partOf = [ "minecraft-server.service" ];
};
networking.firewall.allowedTCPPorts = [ 25565 ];
asxpio.security.ports = [
"tcp/25565/java"