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.cc: make --query evaluate .outPaths #1771

Closed
wants to merge 3 commits into from

Conversation

oxij
Copy link
Member

@oxij oxij commented Dec 31, 2017

NixOS/nixpkgs#33057 delays stdenv.mkDerivation derivation checks (e.g.
meta, brokennes, etc) to .drvPath and .outPath evaluation leaving
other fields accessible. That has a side-effect of making nix-env -qa
list broken packages.

This patch forces those checks.

@vcunat
Copy link
Member

vcunat commented Dec 31, 2017

Well, that's possible, but due to the recursive nature, my previous tests suggested that forcing .out leads to a significant slowdown of nix-env -qa (roughly five-times in my year-old test). On the other hand, it improves semantics – even closure would get checked during -qa.

@vcunat
Copy link
Member

vcunat commented Dec 31, 2017

Except perhaps that queryOutPath seems an overkill, as it queries the binary cache, if I understand it correctly.

@oxij oxij force-pushed the nix-env-query-force-outpath branch from 4bcd132 to f18f523 Compare January 2, 2018 00:18
@oxij
Copy link
Member Author

oxij commented Jan 2, 2018 via email

@oxij oxij force-pushed the nix-env-query-force-outpath branch from f18f523 to 04dbea9 Compare January 2, 2018 01:07
@oxij oxij force-pushed the nix-env-query-force-outpath branch from 04dbea9 to 85cdf2e Compare January 2, 2018 05:38
@oxij
Copy link
Member Author

oxij commented Jan 2, 2018 via email

@oxij oxij force-pushed the nix-env-query-force-outpath branch from 85cdf2e to dec8353 Compare January 2, 2018 14:56
@oxij
Copy link
Member Author

oxij commented Jan 2, 2018 via email

@edolstra
Copy link
Member

edolstra commented Jan 2, 2018

This behaviour (-qa not evaluating outPath) is intentional, see edd145d.

@oxij
Copy link
Member Author

oxij commented Jan 2, 2018 via email

@edolstra
Copy link
Member

edolstra commented Jan 2, 2018

Yes, the motivation is speed.

oxij added a commit to oxij/nixpkgs that referenced this pull request Jan 14, 2018
This is a temporary workaround to make `nix-env -qa` and `nix search` ignore
broken packages as they they did before this patchset.

This patch should be reverted after `nix` gets a proper fix for this.
See NixOS/nix#1771.
@shlevy shlevy added the backlog label Apr 1, 2018
@shlevy shlevy self-assigned this Apr 1, 2018
@oxij oxij force-pushed the nix-env-query-force-outpath branch from dec8353 to e7f25a7 Compare June 12, 2018 03:05
NixOS/nixpkgs#33057 delays `stdenv.mkDerivation` derivation checks (e.g.
meta, brokennes, etc) to `.drvPath` and `.outPath` evaluation leaving
other fields accessible. That has a side-effect of making `nix-env -qa`
list broken packages.

This patch allows to

- evaluate all `.outPath`s in `-qa` output strictly (`--strict` option)
  at the cost of 5x-7x slowdown;
- disable filtering completely with `--all` option at the cost of getting some
  junk in the output and some speedup;
- filter based on `.meta.available` (the default, `--approximate` option)
  at the cost of getting a tiny amounts of junk in the output and
  0.96x-1.04x slowdown.

It is also possible to get near-perfect results with `--approximate` at
the cost of 2x slowdown by setting `config.checkMetaRecursively` in nixpkgs.
@oxij oxij force-pushed the nix-env-query-force-outpath branch from e7f25a7 to b6c847e Compare June 12, 2018 03:08
@oxij
Copy link
Member Author

oxij commented Jun 12, 2018

Updated and rebased onto master. Tested to work with 2.0.4 too.

@oxij
Copy link
Member Author

oxij commented Jun 12, 2018

I tested this to fix both #1963 (with a new one-line change) and NixOS/nixpkgs#37350 as well my original issue. Other -i-like operations (--upgrade, --set) evaluate outpaths already, so no fixing needed there.

Now my conscience is clear.

@Ekleog
Copy link
Member

Ekleog commented Oct 24, 2018

@edolstra (triage) If I read correctly, currently this PR is a 4% slowdown in exchange for fixing #1963 and NixOS/nixpkgs#37350. If so, this sounds like a net gain to me?

@oxij Can you confirm this version is the 4% slowdown you mentioned in #1771 (comment) and not the 7x slowdown indeed?

@oxij
Copy link
Member Author

oxij commented Oct 24, 2018 via email

@oxij
Copy link
Member Author

oxij commented Feb 22, 2019

The first patch here is no longer needed with nix-env -qa filtering semantics change introduced by NixOS/nixpkgs@ae16dd1, i.e. listing broken and unfree packages by default is now an expected behavior (which is fine, IMHO). The second patch is still needed, though, and I'll make a separate PR for that.

@oxij oxij closed this Feb 22, 2019
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.

None yet

5 participants