1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-21 17:01:10 +03:00

Use config name by default, falling back to attr name

This commit is contained in:
Tom McLaughlin 2022-10-19 02:35:44 -07:00
parent 5221e7af04
commit c2cc9aeafd
2 changed files with 15 additions and 9 deletions

View file

@ -55,19 +55,23 @@ with lib;
example = "/run/secrets/github-runner/nixos.token";
};
name = mkOption {
name = let
# Same pattern as for `networking.hostName`
type = types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
baseType = types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
in mkOption {
type = if includeNameDefault then baseType else types.nullOr baseType;
description = lib.mdDoc ''
Name of the runner to configure. Defaults to the hostname.
Changing this option triggers a new runner registration.
'';
example = "nixos";
} // lib.optionalAttrs includeNameDefault {
} // (if includeNameDefault then {
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
};
} else {
default = null;
});
runnerGroup = mkOption {
type = types.nullOr types.str;