From 388bfcef4a51efb55b2b447d2634d16ce486d32c Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Tue, 22 Aug 2023 15:51:54 +0200 Subject: [PATCH] nixos/github-runners: add `nodeRuntimes` option --- nixos/doc/manual/release-notes/rl-2311.section.md | 2 ++ .../continuous-integration/github-runner/options.nix | 8 ++++++++ .../continuous-integration/github-runner/service.nix | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index 825b1c5bd407..9f4622d71555 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -199,6 +199,8 @@ The module update takes care of the new config syntax and the data itself (user - `services.prometheus.exporters` has a new [exporter](https://github.com/hipages/php-fpm_exporter) to monitor PHP-FPM processes, see [#240394](https://github.com/NixOS/nixpkgs/pull/240394) for more details. +- `services.github-runner` / `services.github-runners.` gained the option `nodeRuntimes`. The option defaults to `[ "node20" ]`, i.e., the service supports Node.js 20 GitHub Actions only. The list of Node.js versions accepted by `nodeRuntimes` tracks the versions the upstream GitHub Actions runner supports. See [#249103](https://github.com/NixOS/nixpkgs/pull/249103) for details. + - `programs.gnupg.agent.pinentryFlavor` is now set in `/etc/gnupg/gpg-agent.conf`, and will no longer take precedence over a `pinentry-program` set in `~/.gnupg/gpg-agent.conf`. - `wrapHelm` now exposes `passthru.pluginsDir` which can be passed to `helmfile`. For convenience, a top-level package `helmfile-wrapped` has been added, which inherits `passthru.pluginsDir` from `kubernetes-helm-wrapped`. See [#217768](https://github.com/NixOS/nixpkgs/issues/217768) for details. diff --git a/nixos/modules/services/continuous-integration/github-runner/options.nix b/nixos/modules/services/continuous-integration/github-runner/options.nix index ce8809213724..f2887c7711b3 100644 --- a/nixos/modules/services/continuous-integration/github-runner/options.nix +++ b/nixos/modules/services/continuous-integration/github-runner/options.nix @@ -208,4 +208,12 @@ with lib; ''; default = null; }; + + nodeRuntimes = mkOption { + type = with types; nonEmptyListOf (enum [ "node16" "node20" ]); + default = [ "node20" ]; + description = mdDoc '' + List of Node.js runtimes the runner should support. + ''; + }; } diff --git a/nixos/modules/services/continuous-integration/github-runner/service.nix b/nixos/modules/services/continuous-integration/github-runner/service.nix index 55df83362cb6..535df7f68e07 100644 --- a/nixos/modules/services/continuous-integration/github-runner/service.nix +++ b/nixos/modules/services/continuous-integration/github-runner/service.nix @@ -22,6 +22,7 @@ with lib; let workDir = if cfg.workDir == null then runtimeDir else cfg.workDir; + package = cfg.package.override { inherit (cfg) nodeRuntimes; }; in { description = "GitHub Actions runner"; @@ -47,7 +48,7 @@ in serviceConfig = mkMerge [ { - ExecStart = "${cfg.package}/bin/Runner.Listener run --startuptype service"; + ExecStart = "${package}/bin/Runner.Listener run --startuptype service"; # Does the following, sequentially: # - If the module configuration or the token has changed, purge the state directory, @@ -149,7 +150,7 @@ in else args+=(--token "$token") fi - ${cfg.package}/bin/Runner.Listener configure "''${args[@]}" + ${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/"