Set runner name to attr name for github-runners.${name}
This commit is contained in:
parent
fc8fdb03a0
commit
2c099d1a14
3 changed files with 13 additions and 7 deletions
|
@ -11,7 +11,7 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
options.services.github-runner = import ./github-runner/options.nix args;
|
||||
options.services.github-runner = import ./github-runner/options.nix (args // { includeNameDefault = true; });
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.github-runners.${cfg.name} = cfg;
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, includeNameDefault
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
|
@ -59,6 +64,7 @@ with lib;
|
|||
Changing this option triggers a new runner registration.
|
||||
'';
|
||||
example = "nixos";
|
||||
} // lib.optionalAttrs includeNameDefault {
|
||||
default = config.networking.hostName;
|
||||
defaultText = literalExpression "config.networking.hostName";
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ in
|
|||
{
|
||||
options.services.github-runners = mkOption {
|
||||
default = {};
|
||||
type = with types; attrsOf (submodule { options = import ./github-runner/options.nix args; });
|
||||
type = with types; attrsOf (submodule { options = import ./github-runner/options.nix (args // { includeNameDefault = false; }); });
|
||||
example = {
|
||||
runner1 = {
|
||||
enable = true;
|
||||
|
@ -36,15 +36,15 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
systemd.services = flip mapAttrs' cfg (n: v:
|
||||
systemd.services = flip mapAttrs' cfg (name: v:
|
||||
let
|
||||
svcName = "github-runner-${n}";
|
||||
svcName = "github-runner-${name}";
|
||||
in
|
||||
nameValuePair svcName
|
||||
(import ./github-runner/service.nix (args // {
|
||||
inherit svcName;
|
||||
cfg = v;
|
||||
systemdDir = "github-runner/${n}";
|
||||
cfg = v // { inherit name; };
|
||||
systemdDir = "github-runner/${name}";
|
||||
}))
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue