Skip to content

Don't evaluate packages in nix build#605

Open
B4dM4n wants to merge 1 commit intoMic92:mainfrom
B4dM4n:dont-evaluate-in-nix-build
Open

Don't evaluate packages in nix build#605
B4dM4n wants to merge 1 commit intoMic92:mainfrom
B4dM4n:dont-evaluate-in-nix-build

Conversation

@B4dM4n
Copy link
Copy Markdown
Contributor

@B4dM4n B4dM4n commented Mar 5, 2026

Re-evaluating all attributes can significantly increase the memory consumption of nix build by several GB during the entire runtime of the process and also can take some time for large reviews.

The required derivations are already known from multi_system_eval, so pass them directly to nix build.

Sadly, we can't pass derivations or store paths directly to mkShell/nix-shell, so we need to turn the required outputs to store paths with builtins.storePath and pass them to mkShell.

Re-evaluating all attributes can significantly increase the memory consumption
of `nix build` by several GB during the entire runtime of the process and also
can take some time for large reviews.

The required derivations are already known from `multi_system_eval`, so pass
them directly to `nix build`.

Sadly, we can't pass derivations or store paths directly to
`mkShell`/`nix-shell`, so we need to turn the required outputs to store paths
with `builtins.storePath` and pass them to `mkShell`.
f.write(f' "{attr}"\n')
f.write(" ];\n")
f.write("}")
outputs_file = cache_dir.joinpath("outputs.json")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need a gcroot for derivations on top, if we go with this. Both nix-eval-jobs and nix-instantiate have flags for gcroots for derivations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants