about summary refs log tree commit diff
path: root/corepkgs
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-21T09·51+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-21T09·51+0000
commit37ee6cef992c1a80e790a294b75db8c116be8bbb (patch)
treec9296a3d00ce0768e6200d29b39d11beab48c406 /corepkgs
parent3f3a3ae87b3d72d52842d9a2ffe7010f5b0066b9 (diff)
* Adapted nix-pull to use the new substitute mechanism.
Diffstat (limited to 'corepkgs')
-rw-r--r--corepkgs/Makefile.am2
-rw-r--r--corepkgs/nix-pull/Makefile.am11
-rw-r--r--corepkgs/nix-pull/builder.sh.in34
-rw-r--r--corepkgs/nix-pull/default.nix7
4 files changed, 53 insertions, 1 deletions
diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am
index c9ea11cefca7..ca4cea2fc6d6 100644
--- a/corepkgs/Makefile.am
+++ b/corepkgs/Makefile.am
@@ -1 +1 @@
-SUBDIRS = fetchurl nar buildenv channels
+SUBDIRS = fetchurl nar buildenv channels nix-pull
diff --git a/corepkgs/nix-pull/Makefile.am b/corepkgs/nix-pull/Makefile.am
new file mode 100644
index 000000000000..91adb4853f3b
--- /dev/null
+++ b/corepkgs/nix-pull/Makefile.am
@@ -0,0 +1,11 @@
+all-local: builder.sh
+
+install-exec-local:
+	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
+	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
+	$(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
+	$(INSTALL_PROGRAM) builder.sh $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
+
+include ../../substitute.mk
+
+EXTRA_DIST = default.nix builder.sh.in
diff --git a/corepkgs/nix-pull/builder.sh.in b/corepkgs/nix-pull/builder.sh.in
new file mode 100644
index 000000000000..cc1a125d8f8f
--- /dev/null
+++ b/corepkgs/nix-pull/builder.sh.in
@@ -0,0 +1,34 @@
+#! @shell@ -e
+
+export PATH=/bin:/usr/bin
+
+mkdir $out
+
+cat > $out/fetch <<EOF
+#! @shell@ -e
+
+export PATH=/bin:/usr/bin
+
+echo "downloading \$2..."
+
+export PRINT_PATH=1
+result=(\$(@bindir@/nix-prefetch-url \$2))
+
+hash=\${result[0]}
+path=\${result[1]}
+
+if test "\$hash" != "\$3"; then
+    echo "hash is \$hash, expected \$3"
+    exit 1
+fi
+
+echo "unpacking into \$1..."
+
+if ! @bunzip2@ < "\$path" | @bindir@/nix-store --restore "\$1"; then
+    exit 1
+fi
+
+exit 0
+EOF
+
+chmod +x $out/fetch
diff --git a/corepkgs/nix-pull/default.nix b/corepkgs/nix-pull/default.nix
new file mode 100644
index 000000000000..700d7213141c
--- /dev/null
+++ b/corepkgs/nix-pull/default.nix
@@ -0,0 +1,7 @@
+{system}:
+
+derivation {
+  name = "nix-pull";
+  builder = ./builder.sh;
+  inherit system;
+}