lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ci/pinned: manage nixpkgs and treefmt-nix with npins

Instead of rolling our own update script which only works for a single
pin, let's use npins. We can then use it for the treefmtNix pin as well,
which was mostly unmaintained, so far.

+46 -29
+2 -2
ci/README.md
··· 7 7 8 8 CI may need certain packages from Nixpkgs. 9 9 In order to ensure that the needed packages are generally available without building, 10 - [`pinned-nixpkgs.json`](./pinned-nixpkgs.json) contains a pinned Nixpkgs version tested by Hydra. 10 + [`pinned.json`](./pinned.json) contains a pinned Nixpkgs version tested by Hydra. 11 11 12 - Run [`update-pinned-nixpkgs.sh`](./update-pinned-nixpkgs.sh) to update it. 12 + Run [`update-pinned.sh`](./update-pinned.sh) to update it. 13 13 14 14 ## `ci/nixpkgs-vet.sh BASE_BRANCH [REPOSITORY]` 15 15
+5 -6
ci/default.nix
··· 1 1 let 2 - pinnedNixpkgs = builtins.fromJSON (builtins.readFile ./pinned-nixpkgs.json); 2 + pinned = (builtins.fromJSON (builtins.readFile ./pinned.json)).pins; 3 3 in 4 4 { 5 5 system ? builtins.currentSystem, ··· 10 10 nixpkgs' = 11 11 if nixpkgs == null then 12 12 fetchTarball { 13 - url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz"; 14 - sha256 = pinnedNixpkgs.sha256; 13 + inherit (pinned.nixpkgs) url; 14 + sha256 = pinned.nixpkgs.hash; 15 15 } 16 16 else 17 17 nixpkgs; ··· 25 25 fmt = 26 26 let 27 27 treefmtNixSrc = fetchTarball { 28 - # Master at 2025-02-12 29 - url = "https://github.com/numtide/treefmt-nix/archive/4f09b473c936d41582dd744e19f34ec27592c5fd.tar.gz"; 30 - sha256 = "051vh6raskrxw5k6jncm8zbk9fhbzgm1gxpq9gm5xw1b6wgbgcna"; 28 + inherit (pinned.treefmt-nix) url; 29 + sha256 = pinned.treefmt-nix.hash; 31 30 }; 32 31 treefmtEval = (import treefmtNixSrc).evalModule pkgs { 33 32 # Important: The auto-rebase script uses `git filter-branch --tree-filter`,
-4
ci/pinned-nixpkgs.json
··· 1 - { 2 - "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", 3 - "sha256": "1wzvc9h9a6l9wyhzh892xb5x88kxmbzxb1k8s7fizyyw2q4nqw07" 4 - }
+31
ci/pinned.json
··· 1 + { 2 + "pins": { 3 + "nixpkgs": { 4 + "type": "Git", 5 + "repository": { 6 + "type": "GitHub", 7 + "owner": "NixOS", 8 + "repo": "nixpkgs" 9 + }, 10 + "branch": "nixpkgs-unstable", 11 + "submodules": false, 12 + "revision": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", 13 + "url": "https://github.com/NixOS/nixpkgs/archive/3d1f29646e4b57ed468d60f9d286cde23a8d1707.tar.gz", 14 + "hash": "1wzvc9h9a6l9wyhzh892xb5x88kxmbzxb1k8s7fizyyw2q4nqw07" 15 + }, 16 + "treefmt-nix": { 17 + "type": "Git", 18 + "repository": { 19 + "type": "GitHub", 20 + "owner": "numtide", 21 + "repo": "treefmt-nix" 22 + }, 23 + "branch": "main", 24 + "submodules": false, 25 + "revision": "4f09b473c936d41582dd744e19f34ec27592c5fd", 26 + "url": "https://github.com/numtide/treefmt-nix/archive/4f09b473c936d41582dd744e19f34ec27592c5fd.tar.gz", 27 + "hash": "051vh6raskrxw5k6jncm8zbk9fhbzgm1gxpq9gm5xw1b6wgbgcna" 28 + } 29 + }, 30 + "version": 5 31 + }
-17
ci/update-pinned-nixpkgs.sh
··· 1 - #!/usr/bin/env nix-shell 2 - #!nix-shell -i bash -p jq 3 - 4 - set -euo pipefail 5 - 6 - # https://stackoverflow.com/a/246128 7 - SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 8 - 9 - repo=https://github.com/nixos/nixpkgs 10 - branch=nixpkgs-unstable 11 - file=$SCRIPT_DIR/pinned-nixpkgs.json 12 - 13 - defaultRev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1) 14 - rev=${1:-$defaultRev} 15 - sha256=$(nix-prefetch-url --unpack "$repo/archive/$rev.tar.gz" --name source) 16 - 17 - jq -n --arg rev "$rev" --arg sha256 "$sha256" '$ARGS.named' | tee /dev/stderr > $file
+8
ci/update-pinned.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p npins 3 + 4 + set -euo pipefail 5 + 6 + cd "$(dirname "${BASH_SOURCE[0]}")" 7 + 8 + npins --lock-file pinned.json update