-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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-ifd option to nix-instantiate #3506
Add --include-ifd option to nix-instantiate #3506
Conversation
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 ...
Hm, I don't really want to add flags to the legacy commands ( |
I'm not sure why that's a requirement? To me it seems like a bonus :) |
Is there a This keeps track of "importedDrvs" regardless of
would be the equivalent of:
|
Could this be used to work around #719? |
Yeah, you can register the .drv (or its output) as a gcroot I think, with something like |
Yeah I would just make a little file with all the drv paths and |
I don't think there's any reason you can't do both #3494 and #3506. |
@matthewbauer absolutely one could do both. Why my lambda thing you would write a lambda that both accumulated and logged. I just don't want to see nothing happen because we went back and forth on the exact user interface: clearly there is a strong desire for some way to get this information from Nix. |
Well it's not so useful because no one uses Nix as a library. I think it would be better to just get something working through one of the Nix commands. Adding this feature to |
Given that this is the second instance (compare #3086) someone has taken the time to implement something like this, there seems to be a considerable need. |
So no new Nix features can be stabilised until the experimental CLI has been? |
The new CLI has no equivalent for The old CLI is full of flags that seem "bolted on" with little structure or organization (e.g. There is also the issue of whether we should even want to enshrine the concept of IFD in the user interface. IFD has serious issues as you probably know. |
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
Yeah - avoiding .drv's would be nice. Can you take a look at #3523 which adds a |
Closing in favor of #3523 |
This primop lets you get information on paths realised (pathExists, import, readFile) by Nix. It tracks paths realised in Nix & puts the results under the "paths" attr. For instance: $ nix eval --impure --expr '(builtins.traceContext (import ./.).outPath)' { paths = [ "/nix/store/2mpgi4bvn8py4liv9w3mjxd2c5r7bvv8-source" "/nix/store/3k7i1rdqcgyzjxvqm37hapdidy4ls4s3-source" "/nix/store/kqxic0j6wpsaw2bb51hr1yc1nb1z2xw8-source" ]; value = "/nix/store/3k7i1rdqcgyzjxvqm37hapdidy4ls4s3-source"; } This is an alternative to the --include-eval-refs from NixOS#3523 & --include-ifd from NixOS#3506.
This allows use you to get all drvs that your Nix expression
references. Output looks like this:
This can be put into nix-store to get all paths that will be needed to build the Nix expression:
Comes from discussion in #3494.
/cc @domenkozar @Ericson2314