nix: Store branch reference in nixpkgs-version.nix

This makes it clearer which nixpkgs release we are currently on.
This commit is contained in:
Wolfgang Walther
2024-07-07 11:05:10 +02:00
committed by Wolfgang Walther
parent d9e6d3c7e2
commit 64a6cf8cb8
+5 -3
View File
@@ -32,8 +32,9 @@ let
} }
'' ''
# The list of refs is sorted. The first result will be nixpkgs-unstable, the second the latest stable branch. # The list of refs is sorted. The first result will be nixpkgs-unstable, the second the latest stable branch.
commitHash="$(${curl}/bin/curl "${refUrl}" -H "${githubV3Header}" | ${jq}/bin/jq -r 'sort_by(.ref) | reverse | .[1].object.sha')" # shellcheck disable=SC2207
tarballUrl="${tarballUrlBase}$commitHash.tar.gz" commit=($(${curl}/bin/curl "${refUrl}" -H "${githubV3Header}" | ${jq}/bin/jq -r 'sort_by(.ref) | reverse | [.[1].object.sha, .[1].ref] | @tsv'))
tarballUrl="${tarballUrlBase}''${commit[0]}.tar.gz"
tarballHash="$(${nix}/bin/nix-prefetch-url --unpack "$tarballUrl")" tarballHash="$(${nix}/bin/nix-prefetch-url --unpack "$tarballUrl")"
currentDate="$(${coreutils}/bin/date --iso)" currentDate="$(${coreutils}/bin/date --iso)"
@@ -42,8 +43,9 @@ let
{ {
owner = "NixOS"; owner = "NixOS";
repo = "nixpkgs"; repo = "nixpkgs";
ref = "''${commit[1]}";
date = "$currentDate"; date = "$currentDate";
rev = "$commitHash"; rev = "''${commit[0]}";
tarballHash = "$tarballHash"; tarballHash = "$tarballHash";
} }
EOF EOF