lib.options.optionAttrSetToDocList: add visible = "transparent"#441782
lib.options.optionAttrSetToDocList: add visible = "transparent"#441782roberth merged 4 commits intoNixOS:masterfrom
visible = "transparent"#441782Conversation
roberth
left a comment
There was a problem hiding this comment.
LGTM, and the test is much appreciated.
We now cover the whole (self:Bool × children:Bool) space and while arguably that would be a cleaner representation (with children defaulting to the value of self), but I'd prefer to save that refactor for a major revision where we can implement it without evaluation memory overhead (virtually all docs things under a single mkOption attr).
I did notice duplicate and out of date docs in the NixOS manual, but that's also out of scope for this PR.
So just that one suggestion and then I think it's ready for merge.
I did a quick grep for Looking closer, there's Personally, I'd like to remove the duplication and generate docs for functions like this using nixdoc, like we do for (e.g.) most of |
Allows marking an option as invisible, without excluding its sub-options. In practice, this is similar to `visible = true; internal = true;`, however it is more explicit and less reliant on implementation details.
86d6b52 to
6c20442
Compare
It came up in a discussion that there is a way to mark an option as invisible, or an option's sub-options, but not a way to mark an option as invisible without hiding its sub-options.
Technically, you can mark an option as
internal, and this will have a similar effect. That's because, currently,optionAttrSetToDocListwill not checkinternalwhen deciding whether to recurse into sub-options. However that feels like an implementation detail that I'm uncomfortable relying on. According to their docs,visibleandinternalhave subtly different semantics, too; so I'm uncomfortable using them interchangeably.This PR expands the test suite to explicitly test how
optionAttrSetToDocListhandlesvisibleandinternal, then adds a newvisible = "transparent"value. This new value is used to indicate that the option is not visible, but its sub-options are.Things done
passthru.tests.nix-build lib/tests/release.nixAdd a 👍 reaction to pull requests you find important.