-
-
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
nix: Respect meta.outputsToInstall, and use all outputs by default #6426
Conversation
Are you saying
will work once again, or there will be an alternative UI? |
I'm thinking using the
Not super-intuitive, but the advantage over
|
73225a7
to
5ebc8f1
Compare
Well, you certainly know I like the
could mean
or
You mean the latter, but quite arguably the former is what one would expect if the meaning is given by composition, just as #4543 works. In any event, both are valid things to request with RFC, in case libxml's If you check out https://github.com/NixOS/nixpkgs/blob/master/lib/attrsets.nix, notice https://github.com/NixOS/nixpkgs/blob/f4acbd402b9790add87e4cf543e0199ea7dc3617/lib/attrsets.nix#L598-L601 https://github.com/NixOS/nixpkgs/blob/f4acbd402b9790add87e4cf543e0199ea7dc3617/lib/customisation.nix#L198-L206 I would propose making that part of Nix proper: diff --git a/src/libexpr/primops/derivation.nix b/src/libexpr/primops/derivation.nix
index c0fbe8082..4ec79eab2 100644
--- a/src/libexpr/primops/derivation.nix
+++ b/src/libexpr/primops/derivation.nix
@@ -19,6 +19,7 @@ let
drvPath = strict.drvPath;
type = "derivation";
inherit outputName;
+ outputSpecified = true;
};
}; and then using it so |
|
The problems with
|
Well, we can discuss on the UI call. I suspect many people will be extremely surprised if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a rather big breaking change, isn’t it? Esp. until there’s a way to specify the wanted outputs. It certainly warrants at the very least a changelog entry, and probably also an easy way to get back the old behavior, doesn’t it?
At first I was confused why the package.dev behavior was changing. So this is my attempt to better understand the possibilities: current
option 1Would it help if we only complied with meta.outputsToInstall in the cases where the
This matches expectations with the "binaries first" policy. Though this does make it tougher to easily express only package.out. And that seems to be what option 2Another possible behavior (with appropriate dedup)
This convention would prevent possible mismatch, but does make it much harder to be specific about the intention - so at the moment I don't think this is better or more clear than the previous. option3 (the PR currently?)
It is only the more specific behavior that will be impacted and used by more-informed users. The advantage of this over Option 1 is that it allows arbitrary pairing together outputs as desired. The question is if that use-case is common enough to warrant the additional cases, new usage+syntax and documentation/explanation burden? Can we have the simpler usage of package.out or package.dev still support the expected outcome and mean only out or dev respectively with the Is this a conflict with RFC92 syntax or can it re-use the same machinery? (@Ericson2314 seemed to suggest it can be made consistent). Note: any of these still provide the edge case of mismatched profiles/upgrades with pathological choices, eg: package!dev and package!lib,man as separate elements. |
'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 NixOS#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.
5ebc8f1
to
717298c
Compare
Please don't use We already have the wonky Could |
|
We could use caret ( |
I think only Alternatively, perhaps a cli flag is worth considering? |
The problem with a CLI flag is that isn't not associated with an installable, so you can't select different outputs per installable, as in
|
This idea of allowing more specificity and control about the specific outputs is a more advanced feature. Most of initial users will simply rely upon meta.outputsToInstall. After that there are plenty of issues with Conclusion: I think |
The best use of I would still want
I am not worried about this because, per the code I linked, Nixpkgs is already doing this. Doing it in Nix instead has no marginal cost in terms of the number of allocations. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-29/18903/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/recent-nix-change-worthy-of-greater-attention/18972/1 |
nix profile install
will now install all outputs listed in the package'smeta.outputsToInstall
attribute, or all outputs if that attribute doesn't exist. This makes it behave consistently withnix-env
. Fixes #6385.Furthermore, for consistency, all other
nix
commands do this as well. E.g.nix build
will build and symlink the outputs inmeta.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.