fetchurl: fix downloadToTemp & hashedMirrors#445592
Conversation
The user only specifies |
7330afb to
4a201df
Compare
4a201df to
98df5dd
Compare
infinisil
left a comment
There was a problem hiding this comment.
This was kind of hard to understand, so I improved the code and commit message, I hope this helps:
fetchurl: fix hashedMirrors with downloadToTemp
fetchurlsupportspostFetch, which must not run when fetching fromhashedMirrors, because they provide pre-built derivation outputs.
fetchurlalso supportsdownloadToTemp, which modifies behavior relating topostFetch.Before this commit, a call like
fetchurl { url = "..."; downloadToTemp = true; postFetch = '' mv "$downloadedFile" "$out" ''; }would work in normal scenarios, but fail when fetching from
hashedMirrors, due to how internallydownloadToTempwas not tied topostFetchas closely as it should've been.
This resulted in an error likebuilder [...] failed to produce output pathThis commit fixes this, making
hashedMirrorfetching work even for derivations that havedownloadToTempenabled.
|
@infinisil treefmt fail |
fetchurl supports postFetch, which must not run when fetching from
hashedMirrors, because they provide pre-built derivation outputs.
fetchurl also supports downloadToTemp, which modifies behavior relating
to postFetch.
Before this commit, a call like
fetchurl {
url = "...";
downloadToTemp = true;
postFetch = ''
mv "$downloadedFile" "$out"
'';
}
would work in normal scenarios, but fail when fetching from
hashedMirrors, due to how internally downloadToTemp was not tied to
postFetch as closely as it should've been. This resulted in an error
like
builder [...] failed to produce output path
This commit fixes this, making hashedMirror fetching work even for
derivations that have downloadToTemp enabled.
Co-Authored-By: Silvan Mosberger <[email protected]>
98df5dd to
27a36ae
Compare
balsoft
left a comment
There was a problem hiding this comment.
Otherwise looks better than my version
|
philiptaron
left a comment
There was a problem hiding this comment.
I like Silvan's change a lot.
We must copy the file from
$downloadedFileto$outwhen we'reskipping
postFetch; otherwisehashedMirrorswon't work withdownloadToTemp.The provided test demonstrates a case which fails before this commit.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.