-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fetchTree without the git status slowdown #16026
Copy link
Copy link
Open
Labels
UXThe way in which users interact with Nix. Higher level than UI.The way in which users interact with Nix. Higher level than UI.featureFeature request or proposalFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockingNetworking with the outside (non-Nix) world, input lockinglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etcperformance
Metadata
Metadata
Assignees
Labels
UXThe way in which users interact with Nix. Higher level than UI.The way in which users interact with Nix. Higher level than UI.featureFeature request or proposalFeature request or proposalfetchingNetworking with the outside (non-Nix) world, input lockingNetworking with the outside (non-Nix) world, input lockinglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etcperformance
Fields
Give feedbackNo fields configured for issues without a type.
Is your feature request related to a problem?
I've been working on lazy paths, trying to get rid of all whole-repo readdirs/reads/...
Unfortunately, the shape of
fetchTree's return value does not let me avoid the functionality ofgit statuscleanly, because thedirtyRevattribute presence requires this knowledge.So without #4090,
fetchTreemust be strict in what amounts togit status.Proposed solution
Many ways to do it.
A. Break the signature
inp?dirtyRevbecomesinp.isDirty.flakesandfetch-treeusers may be confused for a while as their dirty sources don't seem dirty until they update their expressions to readisDirty.B. Make
outPathcategorically lazyReturn
{ outPath = ...; sourceInfo = ...; }.This is significantly more breaking, so it should probably be a "rename" considering
fetchTreeadoption.The new function can also remove the need for a
fetchTree { lazy = true; }param; nice and clean.I'd still recommend
isDirtybecause it makes the othersourceInfoattrs likerevshouldn't depend on it either.The
sourceInfo/outPathseparation is clean IMO and an insurance policy against future dynamically-optional attributes.C. GraphQL-inspired retrieval
Get what you ask for, and nothing more
This is annoying, but also a great fit for reproducibility as Nix evolves. Adding an attribute is never a breaking change.
Important for this issue: callers can avoid
dirtyRevcompletely by not asking.That said, if you take "GraphQL" to literally, you'd end up retrieving a bunch of stuff eagerly, and you might have to expose this to users in the
inputs.It should probably keep returning thunky values in those attrs whenever it makes sense, or combine it into a larger fetching strategy choice when that makes sense.
Alternative solutions
yes ^
Additional context
Checklist
Add 👍 to issues you find important.