-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writeClosure: add paths
pre-instantiation filtering and sorting
#300722
base: master
Are you sure you want to change the base?
Conversation
Pre-process paths before feeding to `exportReferencesGraph`. - Remove null. - Manually string-interpolate for sorting. - Sort alphabetically to reduce unnecessary rebuilds.
I guess the question I rather wanted to ask is (I'm not particularly familiar with lazy languages, this is probably very basic): does |
AFAIK, evaluation is independent from realization (build) as long as "import from derivation" (IFD) is not used. For example, if we would like to build After all the evaluation is finished, Nix reads the store derivation of The only read/write things evaluation can affect, when IFD is not involved, is
Those are unfortunately done sequentially, as Nix evaluation doesn't seem to support paralellism. That's probably why built-in fetchers are not used often in Nixpkgs. |
Indeed. I guess I was just blabbering something without giving it any actually thought. Looking back, However, I still don't like the idea of sorting by hashes (squinting an eye, this should be equivalent to a random shuffle, when perturbing any inputs). I'd rather sort by names first and then by hashes, just to have stable layouts. |
It turns out that the order of the paths taken by If we want to change the output order, we'll need to add custom sorting to the |
Description of changes
Pre-process paths before feeding to
exportReferencesGraph
.null
.null
is a common approach to "cancel" a dependency from the override interface. However,exportReferencesGraph
doesn't handlenull
correctly (with or without__structuredAttrs = true
), hence the removal.buildInputs
andnativeBuildInputs
automatically for similar purposes, but such proposal faced the challenge of a few packages' relying on the order of dependency package to determine the order ofPATH
s. Thepaths
attribute ofwriteClosure
doesn't have such issue, as the closure is, by definition, independent to the permutation ofpaths
.Regarding the concern about manual string interpolation, the paths will eventually go through string interpolation before being serialized into a store derivation (
/nix/store/*.drv
) and form$NIX_ATTRS_JSON_FILE
and$NIX_ATTRS_SH_FILE
. Manual string interpolation doesn't change any of thedrvPath
oroutPath
, nor does it introduce extra dependencies or affects realization.Proof:
The following Nix expression evaluates to
true
.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.