42 lines
1 KiB
Nix
42 lines
1 KiB
Nix
{ pkgs, ... }:
|
|
{
|
|
# TODO
|
|
# systemd.services.<name>.serviceConfig.{MemoryMax,CPUQuota}
|
|
systemd.services.valheim-server = {
|
|
description = "Valheim dedicated server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = "valheim";
|
|
Group = "valheim";
|
|
ExecStart = "${pkgs.steamcmd}/bin/steamcmd +login anonymous +force_install_dir /home/valheim/server +app_update 896660 validate +exit && /home/valheim/server/valheim_server.x86_64";
|
|
};
|
|
|
|
users.users.valheim = {
|
|
isSystemUser = true;
|
|
group = "valheim";
|
|
home = "/home/valheim";
|
|
};
|
|
users.groups.valheim = {};
|
|
|
|
networking.firewall = {
|
|
allowedTCPPorts = [ 7777 2456 ];
|
|
allowedUDPPorts = [ 7777 2457 ];
|
|
};
|
|
|
|
services.restic.backups.gameservers = {
|
|
user = "root";
|
|
# TODO: Pick a real backup directory.
|
|
repository = "/backup/gameservers";
|
|
paths = [
|
|
"/var/lib/terraria"
|
|
"/home/valheim/server"
|
|
];
|
|
timeConfig = {
|
|
OnCalendar = "daily";
|
|
};
|
|
};
|
|
}
|