nixos-configs/configurations/servivi/modules/7-days-to-die.nix
matt1432 6ca0d7248b
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: rename some flake attr directories
2024-12-16 15:51:41 -05: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}'
'';
};
};
}