nixos-configs/devices/servivi/modules/7-days-to-die.nix
matt1432 8af4a53238
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(minecraft): update to minix and remove unused
2024-07-12 22:16:00 -04:00

34 lines
883 B
Nix

{pkgs, ...}: let
gamePath = "/var/lib/steam-servers/7-days-to-die";
relativeConfig = "serverconfig-7days.xml";
in {
systemd.extraConfig = "DefaultLimitNOFILE=10240";
# TODO: make backups
# 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}
'';
};
}