nixos/github-runners: add noDefaultLabels option

Add option `noDefaultLabels` which controls the `--no-default-labels`
switch passed to the configure script.
This commit is contained in:
Vincent Haupert
2024-01-22 13:29:45 +01:00
parent ae140cd468
commit a9c807496f
3 changed files with 30 additions and 2 deletions

View File

@@ -39,6 +39,13 @@ in
};
config = {
assertions = flatten (
flip mapAttrsToList config.services.github-runners (name: cfg: map (mkIf cfg.enable) [{
assertion = !cfg.noDefaultLabels || (cfg.extraLabels != [ ]);
message = "`services.github-runners.${name}`: The `extraLabels` option is mandatory if `noDefaultLabels` is set";
}])
);
systemd.services = flip mapAttrs' cfg (n: v:
let
svcName = "github-runner-${n}";