about summary refs log tree commit diff
path: root/corepkgs/fetchurl.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T19·48-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T19·48-0400
commit2dd3117c2723ff08c6226b71d569bcea50d58ad1 (patch)
tree34dcd99d086d20f2dc611afec32fddaf412fcb80 /corepkgs/fetchurl.nix
parent51f9f9924bcd0c30b45e370fc69dc43e6621ef61 (diff)
Inline fetchurl.sh
Diffstat (limited to 'corepkgs/fetchurl.nix')
-rw-r--r--corepkgs/fetchurl.nix17
1 files changed, 12 insertions, 5 deletions
diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix
index 29cf6720b3f1..8fc1c5970bc5 100644
--- a/corepkgs/fetchurl.nix
+++ b/corepkgs/fetchurl.nix
@@ -5,13 +5,20 @@ with import <nix/config.nix>;
 assert (outputHash != "" && outputHashAlgo != "")
     || md5 != "" || sha1 != "" || sha256 != "";
 
+let
+
+  builder = builtins.toFile "fetchurl.sh"
+    ''
+      echo "downloading $url into $out"
+      ${curl} --fail --location --max-redirs 20 "$url" > "$out"
+    '';
+
+in
+    
 derivation {
   name = baseNameOf (toString url);
   builder = shell;
-  args = [ "-e" ./fetchurl.sh ];
-
-  # Compatibility with Nix <= 0.7.
-  id = md5;
+  args = [ "-e" builder ];
 
   # New-style output content requirements.
   outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
@@ -19,7 +26,7 @@ derivation {
   outputHash = if outputHash != "" then outputHash else
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
   
-  inherit system url curl;
+  inherit system url;
 
   # No need to double the amount of network traffic
   preferLocalBuild = true;