infra/nixpkgs-update
2019-08-12 12:16:00 +02:00

30 lines
658 B
Text
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash curl jq
#
# Updates the pinned nixpkgs version
set -euo pipefail
source=nixpkgs.nix
owner=NixOS
repo=nixpkgs-channels
branch=nixos-unstable
echo "finding new revision for $owner/$repo@$branch..."
rev=$(curl -sfL https://api.github.com/repos/$owner/$repo/git/refs/heads/$branch | jq -r .object.sha)
echo "rev=$rev"
url=https://github.com/$owner/$repo/archive/$rev.tar.gz
echo "finding unpacked sha256 for $url..."
sha256=$(nix-prefetch-url --unpack "$url")
echo "generating new $source..."
cat <<NEW_SOURCE | tee "$source"
builtins.fetchTarball {
url = "$url";
sha256 = "$sha256";
}
NEW_SOURCE