Add --headless mode (no stdin read, runs until SIGTERM/exit) + systemd/NixOS examples
ci / check (push) Successful in 2m44s

This commit is contained in:
Sausage Agent
2026-10-18 15:24:20 +00:00
parent c204e1ef0c
commit 01a821ab72
7 changed files with 144 additions and 9 deletions
+23
View File
@@ -0,0 +1,23 @@
# Sausage as a systemd service. Create the world once as the service user:
# nix run git+https://gitea.surma.technology/surma/sausage -- init /var/lib/sausage/world
# Then: install as /etc/systemd/system/sausage.service, `systemctl enable --now sausage`.
# Adjust User and the path to `nix`.
[Unit]
Description=Sausage world
After=network-online.target
Wants=network-online.target
[Service]
User=sausage
WorkingDirectory=/var/lib/sausage
# The loop restarts the host (newest version) after a crash or a broker `exit`.
# --headless: no console, stdin EOF does not stop the world.
ExecStart=/run/current-system/sw/bin/nix run git+https://gitea.surma.technology/surma/sausage#loop -- --headless /var/lib/sausage/world
Restart=on-failure
RestartSec=5
# SIGTERM stops the host cleanly (exit code 0).
KillMode=control-group
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target