* Allow the user to override the list of mirrors for specific
mirror:// sites through environment variables, e.g. NIX_MIRRORS_gnu="ftp://ftp.nluug.nl/pub/gnu/ ftp://ftp.gnu.org/pub/gnu/" or NIX_MIRRORS_sourceforge="http://surfnet.dl.sourceforge.net/sourceforge/" svn path=/nixpkgs/trunk/; revision=9302
This commit is contained in:
parent
6c4fd2e3df
commit
76a8d120a4
|
@ -82,8 +82,14 @@ for url in $urls; do
|
|||
# Assume that SourceForge/GNU/kernel mirrors have better
|
||||
# bandwidth than nix.cs.uu.nl.
|
||||
preferHashedMirrors=
|
||||
|
||||
for url3 in ${!varName}; do
|
||||
|
||||
mirrors=${!varName}
|
||||
|
||||
# Allow command-line override by setting NIX_MIRRORS_$site.
|
||||
varName="NIX_MIRRORS_$site"
|
||||
if test -n "${!varName}"; then mirrors="${!varName}"; fi
|
||||
|
||||
for url3 in $mirrors; do
|
||||
urls2="$urls2 $url3$fileName";
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -28,7 +28,20 @@ assert url != "" -> urls == [];
|
|||
assert (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
||||
|
||||
let urls_ = if urls != [] then urls else [url]; in
|
||||
let
|
||||
|
||||
urls_ = if urls != [] then urls else [url];
|
||||
|
||||
mirrors = import ./mirrors.nix;
|
||||
|
||||
# Names of the master sites that are mirrored (i.e., "sourceforge",
|
||||
# "gnu", etc.).
|
||||
sites =
|
||||
if builtins ? attrNames
|
||||
then builtins.attrNames mirrors
|
||||
else [] /* backwards compatibility */;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
name =
|
||||
|
@ -62,10 +75,10 @@ stdenv.mkDerivation ({
|
|||
# This variable allows the user to override hashedMirrors from the
|
||||
# command-line.
|
||||
"NIX_HASHED_MIRRORS"
|
||||
];
|
||||
] ++ (map (site: "NIX_MIRRORS_${site}") sites);
|
||||
}
|
||||
|
||||
# Pass the mirror locations to the builder.
|
||||
// (import ./mirrors.nix)
|
||||
// mirrors
|
||||
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue