about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJonathan Ringer2021-03-20 10:10:42 -0700
committerJonathan Ringer2021-05-15 09:04:35 -0700
commit5a6540c49c9deadfb2957a97ce9977d51636d82b (patch)
tree367758d63926353af53cb59fc005bcfab91602b9 /nixos
parentb23797e2c58e87ba79ccd433548397ec5ed82ed2 (diff)
nixos/factorio: update admin setting
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/games/factorio.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/services/games/factorio.nix b/nixos/modules/services/games/factorio.nix
index a1aa5739d06b..3cb142757927 100644
--- a/nixos/modules/services/games/factorio.nix
+++ b/nixos/modules/services/games/factorio.nix
@@ -35,10 +35,10 @@ let
     auto_pause = true;
     only_admins_can_pause_the_game = true;
     autosave_only_on_server = true;
-    admins = [];
     non_blocking_saving = cfg.nonBlockingSaving;
   } // cfg.extraSettings;
   serverSettingsFile = pkgs.writeText "server-settings.json" (builtins.toJSON (filterAttrsRecursive (n: v: v != null) serverSettings));
+  serverAdminsFile = pkgs.writeText "server-adminlist.json" (builtins.toJSON cfg.admins);
   modDir = pkgs.factorio-utils.mkModDirDrv cfg.mods;
 in
 {
@@ -52,6 +52,16 @@ in
           The port to which the service should bind.
         '';
       };
+
+      admins = mkOption {
+        type = types.listOf types.str;
+        default = [];
+        example = [ "username" ];
+        description = ''
+          List of player names which will be admin.
+        '';
+      };
+
       openFirewall = mkOption {
         type = types.bool;
         default = false;
@@ -234,6 +244,7 @@ in
           "--start-server=${mkSavePath cfg.saveName}"
           "--server-settings=${serverSettingsFile}"
           (optionalString (cfg.mods != []) "--mod-directory=${modDir}")
+          (optionalString (cfg.admins != []) "--server-adminlist=${serverAdminsFile}")
         ];
 
         # Sandboxing