summaryrefslogtreecommitdiff
path: root/nixos-pin
diff options
context:
space:
mode:
Diffstat (limited to 'nixos-pin')
-rwxr-xr-xnixos-pin14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos-pin b/nixos-pin
new file mode 100755
index 0000000..296073a
--- /dev/null
+++ b/nixos-pin
@@ -0,0 +1,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