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