2024-07-07 01:54:46 -04:00
|
|
|
{pkgs, ...}: let
|
|
|
|
gamePath = "/var/lib/steam-servers/7-days-to-die";
|
|
|
|
relativeConfig = "serverconfig-7days.xml";
|
|
|
|
in {
|
2024-07-13 22:12:35 -04:00
|
|
|
services.borgbackup.configs."seven-days" = {
|
|
|
|
paths = ["/var/lib/steam-servers/7-days-to-die"];
|
|
|
|
startAt = "02/3:00";
|
|
|
|
};
|
2024-07-07 01:54:46 -04:00
|
|
|
|
2024-10-18 22:54:13 -04:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
steam = prev.steam.override {
|
|
|
|
extraPreBwrapCmds = ''
|
|
|
|
mkdir -p "$HOME/.local/share/sevendays/"
|
|
|
|
'';
|
|
|
|
extraBwrapArgs = [
|
|
|
|
''--bind "${gamePath}/" "$HOME/.local/share/sevendays/"''
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-07-13 22:12:35 -04:00
|
|
|
systemd = {
|
|
|
|
extraConfig = "DefaultLimitNOFILE=10240";
|
2024-07-12 22:16:00 -04:00
|
|
|
|
2024-07-13 22:12:35 -04:00
|
|
|
services."7-days-to-die" = {
|
|
|
|
wantedBy = ["multi-user.target"];
|
2024-10-18 22:54:13 -04:00
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = "matt";
|
|
|
|
Group = "users";
|
|
|
|
};
|
2024-07-07 01:54:46 -04:00
|
|
|
|
2024-08-31 19:16:06 -04:00
|
|
|
path = builtins.attrValues {
|
|
|
|
inherit
|
|
|
|
(pkgs)
|
|
|
|
steam-run
|
|
|
|
steamcmd
|
|
|
|
;
|
|
|
|
};
|
2024-07-07 01:54:46 -04:00
|
|
|
|
2024-07-13 22:12:35 -04:00
|
|
|
script = ''
|
|
|
|
# Install / Update server
|
2024-10-18 22:54:13 -04:00
|
|
|
steamcmd +force_install_dir "$HOME/.local/share/sevendays" \
|
2024-07-13 22:12:35 -04:00
|
|
|
+login anonymous +app_update 294420 \
|
|
|
|
+quit
|
2024-07-07 01:54:46 -04:00
|
|
|
|
2024-07-13 22:12:35 -04:00
|
|
|
# Launch server
|
2024-10-18 22:54:13 -04:00
|
|
|
exec steam-run sh -c 'cd "$HOME/.local/share/sevendays"; \
|
|
|
|
exec ./startserver.sh -configfile=${relativeConfig}'
|
2024-07-13 22:12:35 -04:00
|
|
|
'';
|
|
|
|
};
|
2024-07-07 01:54:46 -04:00
|
|
|
};
|
|
|
|
}
|