vuls: init at 0.27.0
[NixPkgs.git] / ci / update-pinned-nixpkgs.sh
blobd44b59d80ede2b946662199e48a7502069a4b609
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p jq
4 set -euo pipefail
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)
14 rev=${1:-$defaultRev}
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