diff --git a/ops/nixos/clouvider-lon01/default.nix b/ops/nixos/clouvider-lon01/default.nix index 8db722fc4a..e700a3c71a 100644 --- a/ops/nixos/clouvider-lon01/default.nix +++ b/ops/nixos/clouvider-lon01/default.nix @@ -233,6 +233,29 @@ in { systemd.tmpfiles.rules = [ "d /run/minotarproxy 0700 minotarproxy - -" ]; + systemd.mounts = let + bindMount' = dir: { + unitConfig.RequiresMountsFor = dir; + options = "bind"; + what = "/persist${dir}"; + where = dir; + }; + bindMountSvc = dir: svc: (bindMount' dir) // { + bindsTo = [svc]; + partOf = [svc]; + }; + bindMountSvcDynamic = dir: svc: (bindMount' "/var/lib/private/${dir}") // { + requiredBy = [svc]; + before = [svc]; + wantedBy = ["multi-user.target"]; + }; + bindMount = dir: (bindMount' dir) // { + wantedBy = ["multi-user.target"]; + }; + in [ + (bindMountSvcDynamic "factorio" "factorio.service") + ]; + environment.etc."secrets/gitlab-runner-registration" = { text = '' @@ -262,5 +285,23 @@ in { nix.gc.automatic = false; + services.factorio = { + inherit (secrets.factorio) username token; + enable = true; + package = pkgs.factorio-headless-experimental; + saveName = "lukegb20201124"; + game-name = "Briefcase Full of Bees"; + extraSettings = { + admins = ["lukegb"]; + auto_pause = true; + only_admins_can_pause_the_game = false; + game_password = secrets.factorioServerPassword; + non_blocking_saving = true; + autosave_only_on_server = true; + autosave_interval = 5; + autosave_slots = 60; + }; + }; + system.stateVersion = "20.09"; }