Try to substitute builtins.fetch*#3721
Closed
matthewbauer wants to merge 1 commit intoNixOS:masterfrom
Closed
Conversation
builtins.fetch* aren’t technically derivations, so they never got substituted. To work around this, we can try to substitute this store path during evaluation. This can happen any time a hash is provided.
Member
|
Please check the flakes branch, it already does this: td::pair<Tree, Input> Input::fetch(ref<Store> store) const
{
if (!scheme)
throw Error("cannot fetch unsupported input '%s'", attrsToJson(toAttrs()));
/* The tree may already be in the Nix store, or it could be
substituted (which is often faster than fetching from the
original source). So check that. */
if (hasAllInfo()) {
try {
auto storePath = computeStorePath(*store);
store->ensurePath(storePath);
debug("using substituted/cached input '%s' in '%s'",
to_string(), store->printStorePath(storePath));
auto actualPath = store->toRealPath(storePath);
return {fetchers::Tree(std::move(actualPath), std::move(storePath)), *this};
} catch (Error & e) {
debug("substitution of input '%s' failed: %s", to_string(), e.what());
}
} |
Member
Author
|
Actually this just applies to fetchTree right? I think it would still be useful for builtins.fetchurl & builtins.fetchTarball. I can make it match what fetchTree does though. |
Member
|
I get the other |
Member
Author
|
Since fetchTree can do substitution on tarballs, I think we are mostly covered just doing fetchTree everywhere. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
builtins.fetch* aren’t technically derivations, so they never got
substituted. To work around this, we can try to substitute this store
path during evaluation. This can happen any time a hash is provided.