summary refs log tree commit diff
path: root/pkgs/build-support/fetchurl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2007-09-11 13:48:53 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2007-09-11 13:48:53 +0000
commit6c4fd2e3df5124dd625711135d82e39f2220d7e3 (patch)
tree4fe77055537168c4e7ffa7c8b956652544730f4b /pkgs/build-support/fetchurl
parentfac97c4e8dbaaff211a1768d78823b6173d4a825 (diff)
downloadnixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar.gz
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar.bz2
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar.lz
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar.xz
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.tar.zst
nixlib-6c4fd2e3df5124dd625711135d82e39f2220d7e3.zip
* Allow the user to override the list of content-addressable mirrors
  from the command-line by setting the NIX_HASHED_MIRRORS environment
  variable.

svn path=/nixpkgs/trunk/; revision=9301
Diffstat (limited to 'pkgs/build-support/fetchurl')
-rw-r--r--pkgs/build-support/fetchurl/builder.sh4
-rw-r--r--pkgs/build-support/fetchurl/default.nix16
2 files changed, 15 insertions, 5 deletions
diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh
index f91edf7c2818..511839655be0 100644
--- a/pkgs/build-support/fetchurl/builder.sh
+++ b/pkgs/build-support/fetchurl/builder.sh
@@ -46,6 +46,10 @@ finish() {
 
 
 tryHashedMirrors() {
+    if test -n "$NIX_HASHED_MIRRORS"; then
+        hashedMirrors="$NIX_HASHED_MIRRORS"
+    fi
+    
     for mirror in $hashedMirrors; do
         url="$mirror/$outputHashAlgo/$outputHash"
         if $curl --fail --silent --show-error --head "$url" \
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index eb40c4c6a910..e752b9313e93 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -52,11 +52,17 @@ stdenv.mkDerivation ({
   outputHash = if outputHash != "" then outputHash else
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
   
-  # 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.
-  impureEnvVars = ["http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"];
+  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 override hashedMirrors from the
+    # command-line.
+    "NIX_HASHED_MIRRORS"
+  ];
 }
 
 # Pass the mirror locations to the builder.