diff --git a/nixos/modules/services/continuous-integration/github-runner/options.nix b/nixos/modules/services/continuous-integration/github-runner/options.nix index b5c8d5d291d5..a2df04e597d8 100644 --- a/nixos/modules/services/continuous-integration/github-runner/options.nix +++ b/nixos/modules/services/continuous-integration/github-runner/options.nix @@ -26,7 +26,7 @@ default = { }; type = lib.types.attrsOf ( lib.types.submodule ( - { name, ... }: + { name, config, ... }: { options = { enable = lib.mkOption { @@ -186,7 +186,11 @@ default = { }; }; - package = lib.mkPackageOption pkgs "github-runner" { }; + package = lib.mkPackageOption pkgs "github-runner" { } // { + apply = + # Support old github-runner versions which don't have the `nodeRuntimes` arg yet. + pkg: pkg.override (old: lib.optionalAttrs (old ? nodeRuntimes) { inherit (config) nodeRuntimes; }); + }; ephemeral = lib.mkOption { type = lib.types.bool; diff --git a/nixos/modules/services/continuous-integration/github-runner/service.nix b/nixos/modules/services/continuous-integration/github-runner/service.nix index d40b51da0eef..aaf8083dc5b9 100644 --- a/nixos/modules/services/continuous-integration/github-runner/service.nix +++ b/nixos/modules/services/continuous-integration/github-runner/service.nix @@ -41,10 +41,6 @@ currentConfigTokenFilename = ".current-token"; workDir = if cfg.workDir == null then runtimeDir else cfg.workDir; - # Support old github-runner versions which don't have the `nodeRuntimes` arg yet. - package = cfg.package.override ( - old: lib.optionalAttrs (lib.hasAttr "nodeRuntimes" old) { inherit (cfg) nodeRuntimes; } - ); in lib.nameValuePair svcName { description = "GitHub Actions runner"; @@ -77,7 +73,7 @@ serviceConfig = lib.mkMerge [ { - ExecStart = "${package}/bin/Runner.Listener run --startuptype service"; + ExecStart = "${cfg.package}/bin/Runner.Listener run --startuptype service"; # Does the following, sequentially: # - If the module configuration or the token has changed, purge the state directory, @@ -196,7 +192,7 @@ else args+=(--token "$token") fi - ${package}/bin/Runner.Listener configure "''${args[@]}" + ${cfg.package}/bin/Runner.Listener configure "''${args[@]}" # Move the automatically created _diag dir to the logs dir mkdir -p "$STATE_DIRECTORY/_diag" cp -r "$STATE_DIRECTORY/_diag/." "$LOGS_DIRECTORY/"