Skip to content

Commit

Permalink
nixos/factorio: update admin setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Ringer committed May 10, 2021
1 parent ce41934 commit b9df8ed
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nixos/modules/services/games/factorio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b9df8ed

Please sign in to comment.