nixos/slurm: add flag option to slurmctld service

This commit is contained in:
2025-12-18 19:47:58 +08:00
parent 7c25c077b8
commit 4bf5c1fc8d

View File

@@ -83,6 +83,25 @@ in
slurm to work properly (see `services.munge.password`).
'';
};
flag = lib.mkOption {
type = lib.types.attrsOf (
lib.types.oneOf [
lib.types.str
lib.types.bool
]
);
default = { };
example = {
"i" = true;
"systemd" = true;
"L" = "/var/log/file with space.log";
};
description = ''
Flags passed to `slurmctld` daemon, see {manpage}`slurmctld(8)`.
Special characters are properly escaped.
'';
};
};
dbdserver = {
@@ -433,7 +452,16 @@ in
serviceConfig = {
Type = "forking";
ExecStart = "${wrappedSlurm}/bin/slurmctld";
ExecStart =
let
isLong = optionName: builtins.stringLength optionName > 1;
flagFormat = optionName: {
option = if isLong optionName then "--${optionName}" else "-${optionName}";
sep = " ";
explicitBool = false;
};
in
"${wrappedSlurm}/bin/slurmctld ${lib.cli.toCommandLineShell flagFormat cfg.server.flag}";
PIDFile = "/run/slurmctld.pid";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
};