summaryrefslogtreecommitdiff
path: root/nix-pin
blob: 30253b65115105e4d21a2318b1b63601eef64ad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env bash

[[ -z $1 ]] && echo "usage: nix-pin <hash>" && exit 1

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

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