-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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: doc: include all modules in manual generation #56020
nixos: doc: include all modules in manual generation #56020
Conversation
Thanks for moving this forward! |
@@ -51,7 +51,7 @@ in rec { | |||
# system configuration. | |||
inherit (lib.evalModules { | |||
inherit prefix check; | |||
modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ]; | |||
modules = baseModules ++ extraModules ++ [ pkgsModule ] ++ modules; |
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.
what is the rational here? AFAIK modules
don't depend on their order.
|
||
with lib; | ||
|
||
let | ||
|
||
cfg = config.documentation; | ||
|
||
manualModules = baseModules ++ optionals cfg.nixos.includeAllModules (extraModules ++ modules); |
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 ignores pkgsModule
module. Why ignore that?
- modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ];
+ modules = baseModules ++ extraModules ++ [ pkgsModule ] ++ modules;
what is the rational here? AFAIK `modules` don't depend on their order.
OCD. This way the order is the same everywhere. This order also makes sense semantically.
+ manualModules = baseModules ++ optionals cfg.nixos.includeAllModules (extraModules ++ modules);
This ignores `pkgsModule` module. Why ignore that?
`pkgsModule` is an autogenerated thing defined at the top of `nixos/lib/eval-config.nix`, it has no options/documentation. When and if `nixpkgs.config` will get structured then this will need to be updated.
|
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.
OCD
OK :)
I'd also like things like documentation only for custom modules, documentation only about used options, documentation about only changed options, but this is very out of scope in this context.
Can you add a release note for this? I think this very much warrants one |
b99203c
to
6ccd848
Compare
Done.
|
I've tried building my system with this patch. Turns out, lots of my custom options are not documented, so I end up in:
Fix was easy, add |
Perhaps gradual enable is needed - first add option with `false` as default, then set it by default true in `nixos-generate-config`, then change default after a few releases.
Well, since adding descriptions to your custom options is a backwards-compatible change I think this breakage is of okay kind.
But for convenience sake, I think, a better approach is to just change that "has no description" error into a warning. The new commit does that.
|
Testing this on my setup uncovered that nixops' option descriptions apparently don't all evaluate:
This should be fixed in nixops and nixpkgs' |
Change default to Because this can fail configuration evaluation, we should warn users first. They update to 19.03, see some red warnings in configuration and know, that option declarations must be fixed before 19.09, because 19.09 will make this behavior default. This is just an idea. Making default |
2c5ce91
to
ee229ba
Compare
Before this change `man 5 configuration.nix` would only show options of modules in the `baseModules` set, which consists only of the list of modules in `nixos/modules/module-list.nix` With this change applied and `documentation.nixos.includeAllModules` option enabled all modules included in `configuration.nix` file will be used instead. This makes configurations with custom modules self-documenting. It also means that importing non-`baseModules` modules like `gce.nix` or `azure.nix` will make their documentation available in `man 5 configuration.nix`. `documentation.nixos.includeAllModules` is currently set to `false` by default as enabling it usually uncovers bugs and prevents evaluation. It should be set to `true` in a release or two. This was originally implemented in NixOS#47177, edited for more configurability, documented and rebased onto master by @oxij.
See NixOS#37903 (comment) for details. With the previous patch and some custom modules included in `configuration.nix` the above bug is very easy to trigger. This is a simplest workaround I have. A proper solution would look like NixOS#37903 (comment).
…out descriptions For convenience, it's not like not having a description is deadly or something.
ee229ba
to
a53b3ba
Compare
I see, I agree that if this uncovers bugs in third-party things then we should wait with setting it to `true` by default.
Rebased onto master, changed the default and documentation. This now adds release notes to 19.09. It's not like this is urgent or anything so enabling this by default in 20.03 should be fine, IMHO.
|
What? Why?
An edited version of #47177. See commit messages below.
git log
nixos: doc: include all modules in manual generation
Before this change
man 5 configuration.nix
would only show options of modules inthe
baseModules
set, which consists only of the list of modules innixos/modules/module-list.nix
With this change applied all modules included in
configuration.nix
file willbe used instead.
This makes configurations with custom modules self-documenting. It also means
that importing non-
baseModules
modules likegce.nix
orazure.nix
will make their documentation available in
man 5 configuration.nix
.This was originally implemented in nixos-manual: Include all modules in documentation generation #47177, edited for more configurability and
rebased onto master by @oxij.
nixos: doc: increase maxdepth for xsltproc
See manual fails to build on master #37903 (comment)
for details. With the previous patch and some custom modules included in
configuration.nix
the above bug is very easy to trigger.This is a simplest workaround I have. A proper solution would look like
manual fails to build on master #37903 (comment).
nix-instantiate
environmentnix-env -qaP
diffsOn x86_64-linux:
On aarch64-linux: ditto
On x86_64-darwin: noop
/cc original author of #47177 @arianvp, documentation aficionados @grahamc @vcunat