about summary refs log tree commit diff
path: root/corepkgs/fetchurl/fetchurl.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'corepkgs/fetchurl/fetchurl.sh.in')
-rw-r--r--corepkgs/fetchurl/fetchurl.sh.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/corepkgs/fetchurl/fetchurl.sh.in b/corepkgs/fetchurl/fetchurl.sh.in
index 7e876a25e2aa..88e4d81f2e48 100644
--- a/corepkgs/fetchurl/fetchurl.sh.in
+++ b/corepkgs/fetchurl/fetchurl.sh.in
@@ -1,7 +1,16 @@
 #! /bin/sh
 
+export PATH=/bin:/usr/bin
+
 echo "downloading $url into $out..."
-@wget@ "$url" -O "$out" || exit 1
+
+prefetch=@prefix@/store/nix-prefetch-url-$md5
+if test -f "$prefetch"; then
+    echo "using prefetched $prefetch";
+    mv $prefetch $out || exit 1
+else
+    @wget@ "$url" -O "$out" || exit 1
+fi
 
 actual=$(@bindir@/nix-hash --flat $out)
 if test "$actual" != "$md5"; then