nixos systemPackages: rework default outputs#12653
nixos systemPackages: rework default outputs#12653vcunat merged 5 commits intoNixOS:closure-sizefrom
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 |
nixos/modules/config/system-path.nix
Outdated
There was a problem hiding this comment.
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.
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.
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 = truebut 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 pkgintosystemPackages.outputsToLinkis 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.