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
Add --include-eval-refs to StorePathCommands #4496
Open
matthewbauer
wants to merge
25
commits into
NixOS:master
Choose a base branch
from
matthewbauer:nix-eval-refs
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
This allows use you to get all drvs that your Nix expression references. Output looks like this: $ nix-instantiate --include-ifd warning: you did not specify '--add-root'; the result might be removed by the garbage collector /nix/store/xvplw4i56ys3j1lk4bxnr8r4725rb6c8-bauer-1.5.0.drv /nix/store/nk7j41ldlq39lmmsg5v1mlwwwpnqnbgk-README.drv /nix/store/pp84r1z7j7aqqarbwkq55h5asy35rs15-package-list.drv This can be piped put into nix-store to get all outputs needed: $ nix-store -qR --include-outputs $(nix-instantiate --include-ifd) /nix/store/00crwk6z71l36av0gspzi0z410h8fq1r-libXtst-1.2.3.tar.bz2 /nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh /nix/store/58y89v7rl254dc2cygcfd5wzhv0kjm4m-bash44-013.drv /nix/store/7c0yirypq720qgj2clyanqp3b18h1lj0-bison-3.4.2.tar.gz.drv /nix/store/b7irlwi2wjlx5aj1dghx4c8k3ax6m56q-busybox.drv /nix/store/c0sr4qdy8halrdrh5dpm7hj05c6hyssa-unpack-bootstrap-tools.sh /nix/store/drsdq2ca1q1dj1hd0r1w2hl4s0fak1vh-bootstrap-tools.tar.xz.drv /nix/store/bfil786fxmnjcwc7mqpm0mk4xnm2cphg-bootstrap-tools.drv ...
This print out all of the store paths referenced in the Nix expression. Examples provided in --help. This is useful with tools like cachix, and replace the previous usages of: $ nix-store -qR --include-outputs $(nix-instantiate '<nixpkgs>' -A hello) which now become: $ nix refs --build --run nixpkgs.hello which can be piped into cachix like: $ nix refs --build --run nixpkgs.hello | cachix push my-cache Related to cachix/cachix#52 and NixOS#3506
nix-instantiate is deprecated!
Both require --recursive. --build calculates all buildtime dependencies of a path. --eval calculates all evaltime dependencies of an expression.
Now used in nix/command.cc error
If we still have the .drv, it will be available in our database under deriver. We can use that instead of requiring we actually received a drvPath.
Co-authored-by: John Ericson <git@JohnEricson.me>
Even non-derivations are important to have in this output, so keep them in our list.
This is more accurate since things like fileExists and readFile also go through this.
Runtime deps aren’t always useful, especially in the case of creating gc roots for eval deps. for instance: $ nix-store --add-result --indirect -r $(nix path-info --recursive --no-run --eval my-expression)
This could have some bad interactions with the eval cache. Once flakes is merged, we can resolve those so that --eval will always reevaluate the expression.
Continuation of NixOS#3523, but with evaluation-time refs this time. More discussion is available at that PR. This keeps track of imported paths when evaluating. When --recursive & --include-eval-refs is passed, these paths & their references are included in the resulting closure.
Why is this closed :( |
I wasn't sure if it was still relevant! I updated it now with resolved merge conflicts. |
I marked this as stale due to inactivity. → More info |
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.
Continuation of #3523, but with evaluation-time refs this time. More discussion is available at that PR.
This keeps track of imported paths when evaluating. When --recursive & --include-eval-refs is passed, these paths & their references are included in the resulting closure.
/cc @domenkozar @edolstra @Ericson2314