mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
545eb50c7d
This script only needs to make sure that the revision has the relevant packages built, it doesn't necessarily need to be a channel version. This commit makes it possible to set the revision explicitly when calling the update script.
18 lines
543 B
Bash
Executable File
18 lines
543 B
Bash
Executable File
#!/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
|
|
|
|
defaultRev=$(git ls-remote "$repo" refs/heads/"$branch" | cut -f1)
|
|
rev=${1:-$defaultRev}
|
|
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
|