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
nixos systemPackages: rework default outputs #12653
Conversation
- Now `pkg.outputUnspecified = true` but this attribute is missing in every output, so we can recognize whether the user chose or not. If (s)he didn't choose, we put `pkg.bin or pkg.out or pkg` into `systemPackages`. - `outputsToLink` is replaced by `extraOutputsToLink`. We add extra outputs *regardless* of whether the user chose anything. It's mainly meant for outputs with docs and debug symbols. - Note that as a result, some libraries will disappear from system path.
By analyzing the blame information on this pull request, we identified @lethalman, @edolstra and @shlevy to be potential reviewers |
For reference, how we handle the outputs:
|
What is |
I needed a way to differentiate between |
@vcunat Why can't you just check outputName? |
@shlevy: Checking |
Ah, I see. Can you give a specific use case where we need to distinguish "this is the first output by default" vs "this is the first output by selection"? |
Hmm, maybe |
@shlevy: example directly in this PR: https://github.com/NixOS/nixpkgs/pull/12653/files#diff-dcba170e079cd72958889058d01a4a02R128 I want to choose some defaults for |
Hm, I see. I guess I think it would be better to just settle on the convention that the first output is the one we want in user envs, or install all outputs. |
Well, the first one is what is put into build inputs, and typically that's different from what you want in user envs (e.g. headers). |
Right, but I think the simple path should be the one that works for users, not devs. If anyone has to specify, it should be people writing build expressions, not people just trying to get their system working. |
Well, string references are the largest problem here, as that's a "simple path" usage mostly used by devs. Of course, now that we can override conversion to strings, it is possible to hack around that, but I'm still leaning to make the "simple path" refer to a |
inherit (config.environment) pathsToLink; | ||
# The default output probably shouldn't be globally configurable. | ||
# Services and users should specify them explicitly unless they want this default. | ||
map (p: if p.outputUnspecified or false then p.bin or p.out or p else p) |
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 should probably be factored out into a separate function, e.g. getOutputsToInstall
or something like that, so it can be re-used in places like the handling of systemd.services.<unit>.path
.
This should probably also be overridable via a package attribute, e.g.
meta.outputsToInstall = [ "bin" "man" ];
which would also be respected by nix-env
.
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.
So let's use meta.outputsToInstall
directly, and stdenv shall fill it in if not specified. The needed nix-env
changes are clear (and trivial, I think).
I'll think on a suitable customization mechanism via the nixpkgs config, but I feel like in the long term we would better unify this perhaps through nixUP or something similar.
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.
I'm still not certain how to best make it customizable, but the nix-env
part really seems clear, so I implemented that now. People would better get that functionality early NixOS/nix#815.
IMHO this per-package |
As a result `systemPackages` now also respect it. Only nix-env remains and that has a PR filed: NixOS/nix#815
This is to get more consistent with `meta.outputsToInstall`.
6222513
to
9a824f2
Compare
Discussed on NixOS/nixpkgs#12653 (comment) (cherry picked from commit 03cbb9a)
Changes Unknown when pulling 9a824f2 on vcunat:p/default-outputs into ** on NixOS:closure-size**. |
pkg.outputUnspecified = true
but this attribute is missing inevery output, so we can recognize whether the user chose or not.
If (s)he didn't choose, we put
pkg.bin or pkg.out or pkg
intosystemPackages
.outputsToLink
is replaced byextraOutputsToLink
.We add extra outputs regardless of whether the user chose anything. (EDIT: this is why I didn't consider 7410c8f good enough.)
It's mainly meant for outputs with docs and debug symbols.
/cc people who touched these things: @edolstra, @lethalman, @dezgeg. Comments are welcome! I expect to merge in a few days.