mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
parent
e0ddabb0d6
commit
2d91012754
1 changed files with 3 additions and 2 deletions
|
@ -24,6 +24,7 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
||||||
|
|
||||||
Path storePath = getAttr("out");
|
Path storePath = getAttr("out");
|
||||||
auto mainUrl = getAttr("url");
|
auto mainUrl = getAttr("url");
|
||||||
|
bool unpack = get(drv.env, "unpack", "") == "1";
|
||||||
|
|
||||||
/* Note: have to use a fresh downloader here because we're in
|
/* Note: have to use a fresh downloader here because we're in
|
||||||
a forked process. */
|
a forked process. */
|
||||||
|
@ -40,12 +41,12 @@ void builtinFetchurl(const BasicDerivation & drv, const std::string & netrcData)
|
||||||
request.decompress = false;
|
request.decompress = false;
|
||||||
|
|
||||||
auto decompressor = makeDecompressionSink(
|
auto decompressor = makeDecompressionSink(
|
||||||
hasSuffix(mainUrl, ".xz") ? "xz" : "none", sink);
|
unpack && hasSuffix(mainUrl, ".xz") ? "xz" : "none", sink);
|
||||||
downloader->download(std::move(request), *decompressor);
|
downloader->download(std::move(request), *decompressor);
|
||||||
decompressor->finish();
|
decompressor->finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (get(drv.env, "unpack", "") == "1")
|
if (unpack)
|
||||||
restorePath(storePath, *source);
|
restorePath(storePath, *source);
|
||||||
else
|
else
|
||||||
writeFile(storePath, *source);
|
writeFile(storePath, *source);
|
||||||
|
|
Loading…
Reference in a new issue