Allow overriding the tarball fetcher #62
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/flake-compat!62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "enobayram/master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This change allows the caller to replace the
fetchTarballused for fetching the inputs of the flake withpkgs.fetchzip, which works as a drop-in replacement. The difference is thatbuiltins.fetchTarballdoes the fetching at Nix evaluation time, whilepkgs.fetchzipdoes the fetching at build time. The distinction becomes crucial when one attempts to build a flake output inside arecursive-nixderivation. A vanillanix build ${someFlake}or anix-build default.nixusing the currentflake-compatwill fail inside a recursive Nix whenfetchTarballattempts to download the tarball, but the following derivation (using theflake-compatfrom this PR) will successfully build (on a system withrecursive-nix):In the above Nix expression, if you remove the
fetchTarballargument from line 11, then the build will fail with:Building a flake recursively like this allows us to hide its evaluation inside a derivation, which can be a world of difference in some cases (see this discussion thread I've opened a few months ago where I've explained in detail how bad this can get).
This approach essentially allows us to get a kind of nix flake output evaluation caching as part of a larger Nix evaluation.
Pull request closed