* 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
@ -83,7 +83,13 @@ for url in $urls; do
|
|||||||
# bandwidth than nix.cs.uu.nl.
|
# bandwidth than nix.cs.uu.nl.
|
||||||
preferHashedMirrors=
|
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";
|
urls2="$urls2 $url3$fileName";
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -28,7 +28,20 @@ assert url != "" -> urls == [];
|
|||||||
assert (outputHash != "" && outputHashAlgo != "")
|
assert (outputHash != "" && outputHashAlgo != "")
|
||||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
|| 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 ({
|
stdenv.mkDerivation ({
|
||||||
name =
|
name =
|
||||||
@ -62,10 +75,10 @@ stdenv.mkDerivation ({
|
|||||||
# This variable allows the user to override hashedMirrors from the
|
# This variable allows the user to override hashedMirrors from the
|
||||||
# command-line.
|
# command-line.
|
||||||
"NIX_HASHED_MIRRORS"
|
"NIX_HASHED_MIRRORS"
|
||||||
];
|
] ++ (map (site: "NIX_MIRRORS_${site}") sites);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pass the mirror locations to the builder.
|
# Pass the mirror locations to the builder.
|
||||||
// (import ./mirrors.nix)
|
// mirrors
|
||||||
|
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user