refactor(nixos): allow grouped SteamCMD arguments
This commit is contained in:
@@ -77,18 +77,12 @@
|
||||
arguments = [
|
||||
"-nographics"
|
||||
"-batchmode"
|
||||
"-name"
|
||||
"main"
|
||||
"-port"
|
||||
"2456"
|
||||
"-world"
|
||||
"main"
|
||||
"-savedir"
|
||||
"/pikachu/media/games/servers/valheim/main"
|
||||
"-password"
|
||||
"foobarbaz"
|
||||
"-public"
|
||||
"0"
|
||||
[ "-name" "main" ]
|
||||
[ "-port" "2456" ]
|
||||
[ "-world" "main" ]
|
||||
[ "-savedir" "/pikachu/media/games/servers/valheim/main" ]
|
||||
[ "-password" "foobarbaz" ]
|
||||
[ "-public" "0" ]
|
||||
];
|
||||
udpPorts = [
|
||||
2456
|
||||
|
||||
@@ -8,6 +8,7 @@ let
|
||||
cfg = config.modules.services.steamcmd;
|
||||
|
||||
libraryPath = lib.concatStringsSep ":" cfg.libraryDirs;
|
||||
arguments = lib.flatten cfg.arguments;
|
||||
|
||||
prepareScript = pkgs.writeShellScript "steamcmd-${cfg.serviceName}-prepare" ''
|
||||
set -eu
|
||||
@@ -37,7 +38,7 @@ let
|
||||
|
||||
cd ${lib.escapeShellArg cfg.installDir}
|
||||
${lib.optionalString (cfg.libraryDirs != [ ]) ''export LD_LIBRARY_PATH=${lib.escapeShellArg libraryPath}:''${LD_LIBRARY_PATH-}''}
|
||||
exec ${lib.getExe pkgs.steam-run} ${lib.escapeShellArg cfg.executable} ${lib.escapeShellArgs cfg.arguments}
|
||||
exec ${lib.getExe pkgs.steam-run} ${lib.escapeShellArg cfg.executable} ${lib.escapeShellArgs arguments}
|
||||
'';
|
||||
|
||||
restartCommand =
|
||||
@@ -102,13 +103,15 @@ in
|
||||
};
|
||||
|
||||
arguments = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
type = lib.types.listOf (lib.types.oneOf [
|
||||
lib.types.str
|
||||
(lib.types.listOf lib.types.str)
|
||||
]);
|
||||
default = [ ];
|
||||
example = [
|
||||
"-name"
|
||||
"main"
|
||||
[ "-name" "main" ]
|
||||
];
|
||||
description = "Arguments passed to the server executable.";
|
||||
description = "Arguments passed to the server executable. Nested lists group related arguments and are flattened before execution.";
|
||||
};
|
||||
|
||||
libraryDirs = lib.mkOption {
|
||||
|
||||
Reference in New Issue
Block a user