nixos-configs/devices/servivi/modules/7-days-to-die.nix
matt1432 715ab8337e
All checks were successful
Discord / discord commits (push) Successful in 1m4s
fix(servers): get 7days server to work again
2024-10-18 22:54:13 -04:00

54 lines
1.2 KiB
Nix

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