summaryrefslogtreecommitdiff
path: root/nixpkgs-pin
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-10-28 21:53:37 -0400
committerBen Sima <ben@bsima.me>2020-10-28 21:53:37 -0400
commite6ab3878bd4307f86200ddf0bfbe415fbf09fb92 (patch)
tree64a893acf594f2929230db0f96ce2473a322433d /nixpkgs-pin
parenta46e6aec3e52dfe422f927d2e4c66de15a9ad90c (diff)
rename nixos-pin
Diffstat (limited to 'nixpkgs-pin')
-rwxr-xr-xnixpkgs-pin20
1 files changed, 20 insertions, 0 deletions
diff --git a/nixpkgs-pin b/nixpkgs-pin
new file mode 100755
index 0000000..bca1dee
--- /dev/null
+++ b/nixpkgs-pin
@@ -0,0 +1,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