-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix empty outputsToInstall for InstallableAttrPath #10825
Conversation
Fixes assertion failure if outputsToInstall is empty by defaulting to the "out" output. That is, behavior between the following commands should be consistent: $ nix build --no-link --json .#nothing-to-install-no-out error: derivation '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-nothing-to-install-no-out.drv' does not have wanted outputs 'out' $ nix build --no-link --file default.nix --json nothing-to-install-no-out error: derivation '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-nothing-to-install-no-out.drv' does not have wanted outputs 'out' Real-world example of this issue: $ nix build --json .#.legacyPackages.aarch64-linux.texlive.pkgs.iwona error: derivation '/nix/store/dj0h6b0pnlnan5nidnhqa0bmzq4rv6sx-iwona-0.995b.drv' does not have wanted outputs 'out' $ git rev-parse HEAD eee33247cf6941daea8398c976bd2dda7962b125 $ nix build --json --file . texlive.pkgs.iwona nix: src/libstore/outputs-spec.hh:46: nix::OutputsSpec::Names::Names(std::set<std::__cxx11::basic_string<char> >&&): Assertion `!empty()' failed. Aborted (core dumped)
I think the root cause here is that |
Yes, in the long run this seems like a more sensible behavior, although I’m not sure if this would be a breaking change since we already default to nix/src/libcmd/installable-flake.cc Lines 146 to 149 in 8e9fc28
For now, I think that the hot fix for a crash should be good enough and consistent with flake installables. |
'nix profile install' will now install all outputs listed in the package's meta.outputsToInstall attribute, or all outputs if that attribute doesn't exist. This makes it behave consistently with nix-env. Fixes #6385. Furthermore, for consistency, all other 'nix' commands do this as well. E.g. 'nix build' will build and symlink the outputs in meta.outputsToInstall, defaulting to all outputs. Previously, it only built/symlinked the first output. Note that this means that selecting a specific output using attrpath selection (e.g. 'nix build nixpkgs#libxml2.dev') no longer works. A subsequent PR will add a way to specify the desired outputs explicitly.
I've tracked the cause down to 1ddabe1, which just adds the It see multiple issues with it:
I'm ok to merge this as a hotfix, but this functionality is bad and should be replaced by something more intentional. |
Thank you @tie |
Motivation
OutputsSpec::Names
constructor requires a non-empty set of output names.nix/src/libstore/outputs-spec.hh
Lines 37 to 46 in 802b4e4
Context
Fixes assertion failure if outputsToInstall is empty by defaulting to the "out" output. That is, behavior between the following commands should be consistent:
Real-world example of this issue:
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.