summaryrefslogtreecommitdiff
path: root/nixos-pin
blob: 296073a35055e0507d3cd07c7f751cee3e8b0ed4 (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/nixos-pin
{
  url = "$url";
  sha256 = "$hash";
}
EOF