about summary refs log tree commit diff
path: root/pkgs/build-support/fetchfile
diff options
context:
space:
mode:
authorMartin Bravenboer <martin.bravenboer@logicblox.com>2004-01-24 23:46:00 +0000
committerMartin Bravenboer <martin.bravenboer@logicblox.com>2004-01-24 23:46:00 +0000
commit067726f3e2db4286b300a67d1f338e5c72e9f986 (patch)
tree3980f9df6f584df20ba4c444f8e16947c787d5e8 /pkgs/build-support/fetchfile
parent02a4d8ece5d153b0a92b869eaab921c1e21c08da (diff)
downloadnixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar.gz
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar.bz2
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar.lz
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar.xz
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.tar.zst
nixlib-067726f3e2db4286b300a67d1f338e5c72e9f986.zip
* Added the j2sdk of Sun for Linux. Downloading this thing is
          a big problem, so I decided to require to user to get the
          file and put it in some location in the file system. wget
          doesn't seem to accept the file scheme however, so I had to
          move the copying into the builder itself. The builder checks
          the md5 hash of the downloaded file. Maybe having a separate
          'fetchfile' would be useful to make a file in the outside
          world pure. I tried to add this to build-support, but this
          obviously did not work. I still committed it. Just remove it
          if you think that it sucks.

svn path=/nixpkgs/trunk/; revision=716
Diffstat (limited to 'pkgs/build-support/fetchfile')
-rwxr-xr-xpkgs/build-support/fetchfile/builder.sh13
-rw-r--r--pkgs/build-support/fetchfile/default.nix9
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchfile/builder.sh b/pkgs/build-support/fetchfile/builder.sh
new file mode 100755
index 000000000000..e2d7b256f87f
--- /dev/null
+++ b/pkgs/build-support/fetchfile/builder.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+. $stdenv/setup
+
+echo "copying $url into $out..."
+
+cp "$pathname" "$out" || exit 1
+
+actual=$(md5sum -b $out | cut -c1-32)
+if test "$actual" != "$md5"; then
+    echo "hash is $actual, expected $md5"
+    exit 1
+fi
diff --git a/pkgs/build-support/fetchfile/default.nix b/pkgs/build-support/fetchfile/default.nix
new file mode 100644
index 000000000000..88f7aa42aa8c
--- /dev/null
+++ b/pkgs/build-support/fetchfile/default.nix
@@ -0,0 +1,9 @@
+{stdenv}: {pathname, md5}: derivation {
+  name = baseNameOf (toString url);
+  system = stdenv.system;
+  builder = ./builder.sh;
+  stdenv = stdenv;
+  pathname = pathname;
+  md5 = md5;
+  id = md5;
+}