1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-18 23:50:07 +03:00

nixos/github-runners: add nodeRuntimes option

This commit is contained in:
Vincent Haupert 2023-08-22 15:51:54 +02:00
parent 73babca767
commit 388bfcef4a
3 changed files with 13 additions and 2 deletions

View file

@ -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.
'';
};
}

View file

@ -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/"