diff --git a/devices/servivi/modules/7-days-to-die.nix b/devices/servivi/modules/7-days-to-die.nix index 792b006b..32d29381 100644 --- a/devices/servivi/modules/7-days-to-die.nix +++ b/devices/servivi/modules/7-days-to-die.nix @@ -2,33 +2,37 @@ gamePath = "/var/lib/steam-servers/7-days-to-die"; relativeConfig = "serverconfig-7days.xml"; in { - systemd.extraConfig = "DefaultLimitNOFILE=10240"; + services.borgbackup.configs."seven-days" = { + paths = ["/var/lib/steam-servers/7-days-to-die"]; + startAt = "02/3:00"; + }; - # TODO: make backups + systemd = { + extraConfig = "DefaultLimitNOFILE=10240"; - # https://github.com/Krutonium/NewNix/blob/455aafc4caf553248ca228f844f021cecf494dc2/services/sevendaystodie.nix#L6 - systemd.services."7-days-to-die" = { - wantedBy = ["multi-user.target"]; - serviceConfig.User = "matt"; + services."7-days-to-die" = { + wantedBy = ["multi-user.target"]; + serviceConfig.User = "matt"; - path = with pkgs; [ - steam-run - steamcmd - ]; + path = with pkgs; [ + steam-run + steamcmd + ]; - script = '' - # Make sure gamePath exists and cd to it - mkdir -p ${gamePath} - cd ${gamePath} + 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 + # 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} - ''; + # Launch server + steam-run ./startserver.sh -configfile=${relativeConfig} + ''; + }; }; } diff --git a/modules/borgbackup/default.nix b/modules/borgbackup/default.nix index 954238ba..79c20dc9 100644 --- a/modules/borgbackup/default.nix +++ b/modules/borgbackup/default.nix @@ -9,12 +9,20 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi" ]; } + { name = "mc"; authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi" ]; } + + { + name = "seven-days"; + authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPijoxuSwH9IrS4poewzHHwe64UoX4QY7Qix5VhEdqKR root@servivi" + ]; + } ]; }; }