summaryrefslogtreecommitdiff
path: root/nixpkgs-pin
blob: bca1deee7e5fbc7096fcda502d34831f57324d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

function usage {
  echo "usage: nixpkgs-pin <hash>"
  echo "where <hash> is a git sha from the nixpkgs repo"
  exit 1
}

[[ -z $1 ]] && usage

url="https://github.com/NixOS/nixpkgs/archive/$1.tar.gz"
hash=$(nix-prefetch-url --unpack $url)

cat <<EOF
# generated with ~/bin/nixpkgs-pin
{
  url = "$url";
  sha256 = "$hash";
}
EOF