Skip to content
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

nix-env: validate json outputsToInstall #3584

Open
wants to merge 2 commits into
base: master
from

Conversation

@LnL7
Copy link
Member

LnL7 commented May 10, 2020

This isn't particularly useful since the json output already includes
metadata. However the evaluation behaves differently, in this case
meta.outputsToInstall is also validated. The same is done by the
channel index generation but it's currently not exposed in a way other
tools like ofborg could use it.

https://github.com/NixOS/nixos-channel-scripts/blob/7a681103b2b3ce150f7f96394f19aa0ad4797ca1/generate-programs-index.cc#L110

If this flag is added to the ofborg evaluation checks it should catch problems like NixOS/nixpkgs#87138 in the future.

/cc @grahamc @cole-h

@LnL7 LnL7 force-pushed the LnL7:query-outputs-to-install branch from f1c2d5d to 8ac5d67 May 10, 2020
@LnL7
Copy link
Member Author

LnL7 commented May 10, 2020

Alternatively I could add this to --json somewhere, for example by replacing the plain outputsToInstall value with a lookup.

@edolstra
Copy link
Member

edolstra commented May 12, 2020

It seems misleading that --outputs doesn't print the outputs but only the outputs that would be installed.

I agree it would be better to add it to --json, since this info isn't really useful for human consumption.

@LnL7 LnL7 force-pushed the LnL7:query-outputs-to-install branch from 8ac5d67 to 3a91ec9 May 12, 2020
LnL7 added 2 commits May 12, 2020
This means meta.outputsToInstall is now always available, even when not
defined by the derivation (ie. all outputs).  Also enforces it's value
is valid, useful for tooing that evaluates nix expressions like ofborg.

Similar logic is used by the channel update script https://github.com/NixOS/nixos-channel-scripts/blob/7a681103b2b3ce150f7f96394f19aa0ad4797ca1/generate-programs-index.cc#L1
@LnL7 LnL7 force-pushed the LnL7:query-outputs-to-install branch from 3a91ec9 to 85e8add May 12, 2020
@LnL7
Copy link
Member Author

LnL7 commented May 12, 2020

I wasn't sure what the behaviour of --json was with regard to errors, but since ofborg uses it to check evaluation I assume it's expected to stop just like the other commands.

@LnL7 LnL7 changed the title nix-env: add --outputs flag nix-env: validate json outputsToInstall May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.