diff options
Diffstat (limited to 'ci/update-pinned-nixpkgs.sh')
-rwxr-xr-x | ci/update-pinned-nixpkgs.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ci/update-pinned-nixpkgs.sh b/ci/update-pinned-nixpkgs.sh new file mode 100755 index 0000000000000..7765581300572 --- /dev/null +++ b/ci/update-pinned-nixpkgs.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p jq + +set -euo pipefail + +# https://stackoverflow.com/a/246128 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +repo=https://github.com/nixos/nixpkgs +branch=nixpkgs-unstable +file=$SCRIPT_DIR/pinned-nixpkgs.json + +rev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1) +sha256=$(nix-prefetch-url --unpack "$repo/archive/$rev.tar.gz" --name source) + +jq -n --arg rev "$rev" --arg sha256 "$sha256" '$ARGS.named' | tee /dev/stderr > $file |