mirror-tarballs: automatize choice of the NixPkgs branch
At deploy-eval time of bastion, but that should suffice I think.
Vladimír Čunát committed
Mar 8, 2023 at 12:31 UTC
00e75df10e65e90382abe7d07a1871c8ec50ebb5
1 file changed
+11
-4
modules/tarball-mirror.nix
+11
-4
@@ -10,9 +10,16 @@
10
with lib;
11
12
let
13
-
14
- nixosRelease = "22.11";
15
-
13
+ # Determine the NixPkgs branch to mirror from.
14
+ # We take the current pirmary stable release.
15
+ inherit (import ../channels.nix) channels;
16
+ branches = lib.filter (p: p != null) (
17
+ lib.mapAttrsToList
18
+ (name: v: if v.variant or null == "primary" && v.status or null == "stable"
19
+ then name else null)
20
+ (import ../channels.nix).channels
21
+ );
22
+ branch = assert lib.length branches == 1; head branches;
23
in
24
25
{
@@ -38,7 +45,7 @@ in
45
fi
46
cd $dir
47
git remote update origin
41
- git checkout origin/nixos-${nixosRelease}
48
+ git checkout origin/${branch}
49
# FIXME: use IAM role.
50
export AWS_ACCESS_KEY_ID=$(sed 's/aws_access_key_id=\(.*\)/\1/ ; t; d' ~/.aws/credentials)
51
export AWS_SECRET_ACCESS_KEY=$(sed 's/aws_secret_access_key=\(.*\)/\1/ ; t; d' ~/.aws/credentials)