nixos-configs/devices/servivi/modules/7-days-to-die.nix
matt1432 52242e645a
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: use simple instead of oneshot type for systemd
2024-07-07 01:54:46 -04:00

32 lines
859 B
Nix

{pkgs, ...}: let
gamePath = "/var/lib/steam-servers/7-days-to-die";
relativeConfig = "serverconfig-7days.xml";
in {
systemd.extraConfig = "DefaultLimitNOFILE=10240";
# https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6
systemd.services."7-days-to-die" = {
wantedBy = ["multi-user.target"];
serviceConfig.User = "matt";
path = with pkgs; [
steam-run
steamcmd
];
script = ''
# Make sure gamePath exists and cd to it
mkdir -p ${gamePath}
cd ${gamePath}
# Install / Update server
steamcmd +force_install_dir ${gamePath} \
+login anonymous +app_update 294420 \
-beta latest_experimental \
+quit
# Launch server
steam-run ./startserver.sh -configfile=${relativeConfig}
'';
};
}