1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p jq
6 # https://stackoverflow.com/a/246128
7 SCRIPT_DIR
=$
( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev
/null
&& pwd )
9 repo
=https
://github.com
/nixos
/nixpkgs
10 branch
=nixpkgs-unstable
11 file=$SCRIPT_DIR/pinned-nixpkgs.json
13 defaultRev
=$
(git ls-remote
"$repo" refs
/heads
/"$branch" | cut
-f1)
15 sha256
=$
(nix-prefetch-url
--unpack "$repo/archive/$rev.tar.gz" --name source)
17 jq
-n --arg rev "$rev" --arg sha256
"$sha256" '$ARGS.named' |
tee /dev
/stderr
> $file