Do some let-floating to prevent repeated evaluation of impureEnvVars

This commit is contained in:
Eelco Dolstra 2012-08-13 00:01:41 -04:00
parent 50cc5629af
commit 1baf48f087

View File

@ -22,6 +22,21 @@ let
then builtins.attrNames mirrors then builtins.attrNames mirrors
else [] /* backwards compatibility */; 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 in
{ # URL to fetch. { # URL to fetch.
@ -84,22 +99,7 @@ stdenv.mkDerivation {
outputHash = if outputHash != "" then outputHash else outputHash = if outputHash != "" then outputHash else
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
impureEnvVars = [ inherit showURLs mirrorsFile 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;
# Doing the download on a remote machine just duplicates network # Doing the download on a remote machine just duplicates network
# traffic, so don't do that. # traffic, so don't do that.