WIP: nixos: mkEnableOption on steroids for discoverable man configuration.nix#14860
WIP: nixos: mkEnableOption on steroids for discoverable man configuration.nix#14860oxij wants to merge 4 commits intoNixOS:masterfrom
man configuration.nix#14860Conversation
…tion.nix(5) manual page
…unctions This allows one to specify "related packages" in NixOS that get rendered into the configuration.nix(5) man page. The interface philosophy is pretty much stolen from TeX bibliography.
97b309c to
78b784b
Compare
|
This PR doesn't really describe what it does. What does the generated manpage look like? 👎 on function names like |
It (mostly) does #9306, but I guess it's easier to show, than to explain. Added a screenshot to the top.
Yep, names are subject to change. NixOS already has So, you can safely assume that the current set of patches won't add any Moreover, I actually plan to add another which reduces to Moreover, if one to group all the fonts in Can we agree that this is cool? (I would then also try to drop Ask away if something is still unclear. |
|
I've just read through the patch (and your comments), and I honestly don't get what it's doing. Is there a 5-word summary for us mere mortals? A better |
|
After thinking some more about this, I think I can push all of this into look? We can probably even specify default defaults [sic!] in types if |
|
I agree with @edolstra , adding additional In #14860 (comment) I will suggest that you rename I do not understand what |
|
Okay then, type hackery it is. "> I do not understand what Multiple possible options and/or (bah, github mail reply cites broke) |
|
In relation to the font example, you might be interested by how the input methods plugins option description is generated. (It use the attribute set trick you described) Also the input method packages option use an extended package type that check a meta attribute of the package so an unrelated package cannot be used. (the main motivation was that different input methods have similar plugins names so it is easy to mistake a In the input method case, it would be nice and more flexible to generate the option description by automatically selecting packages with the right meta attribute, but as far as I know there is no cheap way to do that at the moment. |
I still do not understand what this is supposed to mean. Is that a way to limit the set of packages that you can use as argument, like an enum? |
|
I really like the idea of listing the supported alternatives for module options 👍 personally I'd prefer nixos-option to list them and not having to look them up in a man page but that would probably be easy to add. I'm just not sure if the options should be hard-coded into the module. Maybe the package should be able to link itself to a module (-option) (something like |
|
|
Ping all. |
|
Arseniy Seroka [email protected] writes:
I remember about this, but my hand are currently pretty full with other |
|
Feel free to reopen if there is still interest in this. |
|
Hm. Okay. How do I reopen this? There's no such button. |
|
Well, whatever. Please see #32424. |
|
ping
|

This is a WIP on #9306. I wanted to implement this for a while now, and now it even kinda works, and generates pretty awesome man page if I may say so myself.
How to test this:
Merge with your local branch.
Do
(you might need to set your
NIX_PATH)Run
man result/share/man/man5/configuration.nix.5.Lo and behold.
Search, e.g.
/tmux.Lo and behold again.
Current problems:
Needs a ton of refactoring in
nixos/modules, I rewrote a bunch of pieces just for testing purposes, butgrepshows that there's a lot of work there. Hopefully (but not likely), I will work that out till the end of this week.Ideally, this code needs to access
metas of all the packages, but broken derivations, derivations with unfree licenses, and derivations with assertions evaluate to exceptions. That's even more crazy: they fail differently:p.metaaccess (instdenv.mkDerivation).callPackage, that is, access top, that is, even beforemkDerivation. Which makes sense, but that's too strict for both pretty and complete solution I had in mind.For now I just commented unfree (because I didn't want to mark them as "broken") and assert-failing packages out.
The former case can probably be fixed by some kind of
stdenvhack that pushesmetaout as early as possible.The latter needs
nixsupport for catching exceptions (and assertions) or a new style of derivation definitions a-la "nixos modules with assertions".If this got to be implemented somehow I would totally start generating and then searching a separate man page with descriptions of all the available packages instead of
nix-env -q.As it turns out, quite a lot of nixos modules are nonfunctional simply because they refer to nonexistent packages. Rewriting them using this mechanisms highlights all of those previously invisible problems (which is good, but annoying).
Names of the new functions are ugly, better ideas are very much welcome.
Questionable design decisions:
packagesinmkOption. At first I did a separatemkOption-variant for this, but then all the functions using it got really ugly. So I decided that emulating TeX bibliography is okay (the idea is that the last paragraph in the description says "what are those packages listed here for").Things done
nix-build --option build-use-chroot trueor nix.useChroot on NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)