diff options
author | RTUnreal <unreal@rtinf.net> | 2023-11-21 20:29:43 +0100 |
---|---|---|
committer | RTUnreal <unreal@rtinf.net> | 2023-11-21 20:29:43 +0100 |
commit | 648ffcecaec71d992ac714b07fe4bee2e482737f (patch) | |
tree | 6565e2c97e7eb22f00d1f3624311aab8e43221d5 /nixos/modules/services/games | |
parent | 20e9267cbb4b145906380b918c08c7904c31fc6f (diff) |
fix some errors
Diffstat (limited to 'nixos/modules/services/games')
-rw-r--r-- | nixos/modules/services/games/factorio.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/services/games/factorio.nix b/nixos/modules/services/games/factorio.nix index dcbd50ef05ef..c72282d78c81 100644 --- a/nixos/modules/services/games/factorio.nix +++ b/nixos/modules/services/games/factorio.nix @@ -38,7 +38,7 @@ let non_blocking_saving = cfg.nonBlockingSaving; } // cfg.extraSettings; serverSettingsString = builtins.toJSON (filterAttrsRecursive (n: v: v != null) serverSettings); - serverSettingsFile = pkgs.writeText "server-settings.json"; + serverSettingsFile = pkgs.writeText "server-settings.json" serverSettingsString; serverAdminsFile = pkgs.writeText "server-adminlist.json" (builtins.toJSON cfg.admins); modDir = pkgs.factorio-utils.mkModDirDrv cfg.mods cfg.mods-dat; in @@ -269,15 +269,15 @@ in after = [ "network.target" ]; preStart = - toString [ + (toString [ "test -e ${stateDir}/saves/${cfg.saveName}.zip" "||" "${cfg.package}/bin/factorio" "--config=${cfg.configFile}" "--create=${mkSavePath cfg.saveName}" (optionalString (cfg.mods != []) "--mod-directory=${modDir}") - ] - + (optionalString hasExtraSettings ("\necho ${lib.strings.escapeShellArgs serverSettingsString}" + ]) + + (optionalString (cfg.extraSettingsFile != null) ("\necho ${lib.strings.escapeShellArg serverSettingsString}" + " \"$(cat ${cfg.extraSettingsFile})\" | ${lib.getExe pkgs.jq} -s add" + " > ${stateDir}/server-settings.json")); @@ -294,7 +294,7 @@ in "--bind=${cfg.bind}" (optionalString (!cfg.loadLatestSave) "--start-server=${mkSavePath cfg.saveName}") "--server-settings=${ - if hasExtraSettings + if (cfg.extraSettingsFile != null) then "${stateDir}/server-settings.json" else serverSettingsFile }" |