summary refs log tree commit diff
path: root/pkgs/build-support/fetchurl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 00:01:41 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-13 15:15:16 -0400
commit1baf48f0870d7077643e1ad92e2308b422a71e90 (patch)
treebba4ed0658be3e6b052f8b43950f9b5c030388b0 /pkgs/build-support/fetchurl
parent50cc5629af2292c506f904f52ed2f722b82d75aa (diff)
downloadnixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar.gz
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar.bz2
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar.lz
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar.xz
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.tar.zst
nixlib-1baf48f0870d7077643e1ad92e2308b422a71e90.zip
Do some let-floating to prevent repeated evaluation of impureEnvVars
Diffstat (limited to 'pkgs/build-support/fetchurl')
-rw-r--r--pkgs/build-support/fetchurl/default.nix32
1 files changed, 16 insertions, 16 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index ec3d45e652e8..cc59dd7fab1e 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -22,6 +22,21 @@ let
     then builtins.attrNames mirrors
     else [] /* backwards compatibility */;
 
+  impureEnvVars = [
+    # We borrow these environment variables from the caller to allow
+    # easy proxy configuration.  This is impure, but a fixed-output
+    # derivation like fetchurl is allowed to do so since its result is
+    # by definition pure.
+    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
+
+    # This variable allows the user to pass additional options to curl
+    "NIX_CURL_FLAGS"
+
+    # This variable allows the user to override hashedMirrors from the
+    # command-line.
+    "NIX_HASHED_MIRRORS"
+  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
+
 in
       
 { # URL to fetch.
@@ -83,23 +98,8 @@ stdenv.mkDerivation {
       if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
   outputHash = if outputHash != "" then outputHash else
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
-  
-  impureEnvVars = [
-    # We borrow these environment variables from the caller to allow
-    # easy proxy configuration.  This is impure, but a fixed-output
-    # derivation like fetchurl is allowed to do so since its result is
-    # by definition pure.
-    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
-
-    # This variable allows the user to pass additional options to curl
-    "NIX_CURL_FLAGS"
-
-    # This variable allows the user to override hashedMirrors from the
-    # command-line.
-    "NIX_HASHED_MIRRORS"
-  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
 
-  inherit showURLs mirrorsFile;
+  inherit showURLs mirrorsFile impureEnvVars;
 
   # Doing the download on a remote machine just duplicates network
   # traffic, so don't do that.