Make the hashes mirrors used by builtins.fetchurl configurable
In particular, this allows it to be disabled in our tests.
This commit is contained in:
parent
4ec6eb1fdf
commit
49304bae81
4 changed files with 42 additions and 8 deletions
|
|
@ -38,12 +38,15 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
|||
|
||||
std::shared_ptr<std::string> data;
|
||||
|
||||
try {
|
||||
if (getAttr("outputHashMode") == "flat")
|
||||
data = fetch("http://tarballs.nixos.org/" + getAttr("outputHashAlgo") + "/" + getAttr("outputHash"));
|
||||
} catch (Error & e) {
|
||||
debug(e.what());
|
||||
}
|
||||
if (getAttr("outputHashMode") == "flat")
|
||||
for (auto hashedMirror : settings.hashedMirrors.get())
|
||||
try {
|
||||
if (!hasSuffix(hashedMirror, "/")) hashedMirror += '/';
|
||||
data = fetch(hashedMirror + getAttr("outputHashAlgo") + "/" + getAttr("outputHash"));
|
||||
break;
|
||||
} catch (Error & e) {
|
||||
debug(e.what());
|
||||
}
|
||||
|
||||
if (!data) data = fetch(getAttr("url"));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue