From b5556c84b2d164234429a54d06fc4e581dd231d8 Mon Sep 17 00:00:00 2001 From: "nix-backports[bot]" <190413589+nix-backports[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:47:25 -0500 Subject: [PATCH] [Backport release-24.11] github-runner: use finalAttrs to make it possible to override the version (#363758) github-runner: use finalAttrs to make it possible to override the version (#363733) With rec, it is nearly impossible to override the version since it is used in so many different places in the nix expression. With the current change, it is possible to override version and src to build a different version. (cherry picked from commit d298ddec02bad2108412ffc0f7156c1d91993557) Co-authored-by: Ramses --- pkgs/by-name/gi/github-runner/package.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/gi/github-runner/package.nix b/pkgs/by-name/gi/github-runner/package.nix index 96826704e00cc..c034032a1ae0f 100644 --- a/pkgs/by-name/gi/github-runner/package.nix +++ b/pkgs/by-name/gi/github-runner/package.nix @@ -23,14 +23,14 @@ # Node.js runtimes supported by upstream assert builtins.all (x: builtins.elem x [ "node20" ]) nodeRuntimes; -buildDotnetModule rec { +buildDotnetModule (finalAttrs: { pname = "github-runner"; version = "2.321.0"; src = fetchFromGitHub { owner = "actions"; repo = "runner"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-KZ072v5kYlD78RGQl13Aj05DGzj2+r2akzyZ1aJn93A="; leaveDotGit = true; postFetch = '' @@ -52,7 +52,7 @@ buildDotnetModule rec { git config user.name "root" git add . git commit -m "Initial commit" - git checkout -b v${version} + git checkout -b v${finalAttrs.version} ) mkdir -p $TMPDIR/bin cat > $TMPDIR/bin/git </dev/null version=$($out/bin/Runner.Listener --version) - if [[ "$version" != "${version}" ]]; then + if [[ "$version" != "${finalAttrs.version}" ]]; then printf 'Unexpected version %s' "$version" exit 1 fi @@ -347,4 +347,4 @@ buildDotnetModule rec { ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; -} +})