Skip to content
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-manual: Include all modules in documentation generation #47177

Closed
wants to merge 1 commit into from

Conversation

arianvp
Copy link
Member

@arianvp arianvp commented Sep 22, 2018

Previously, 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

however, with this change, any extra module that is included
in your configuration.nix file by the means of

  imports = [ ./rootfs.nix ]

will also be included the generated documentation.

Example output:

OPTIONS
       You can use the following options in configuration.nix.

       arian.rootfs.device
           The device that contains the btrfs volume

           Type: string

           Declared by:
               /home/arian/Projects/nixos-stuff/computers/t430s/rootfs.nix

       boot.enableContainers
           Whether to enable support for nixos containers.

           Type: boolean

           Default: true

           Declared by:
               <nixpkgs/nixos/modules/virtualisation/containers.nix>
Motivation for this change

I found it useful for my machine to be self-documenting. It also means
that if you import modules like gce.nix or azure.nix which aren't in
module-list.nix, documentation is still generated for these modules

cc: #11499

Things to do
  • I have no idea if this patch impacts the way the documentation for https://nixos.org/nixos
    is generated. It might. We should check this.

@arianvp
Copy link
Member Author

arianvp commented Sep 22, 2018

/cc @oxij

@arianvp
Copy link
Member Author

arianvp commented Sep 22, 2018

Ah apparently using <nixos-config> doesn't work here for CI. Alas

@oxij
Copy link
Member

oxij commented Sep 23, 2018 via email

@arianvp
Copy link
Member Author

arianvp commented Sep 23, 2018

Just my unfamiliarity. I somehow was convinced that the modules argument was not injected into each module by evalModules so that's why I evalled <nixos-config> instead. If modules is indeed passed as a parameter than that is indeed a more elegant solution and will also not break CI. I'll investigate tomorrow. Thanks for the feedback!

@arianvp
Copy link
Member Author

arianvp commented Sep 23, 2018

I haved used your suggestions! Seems to build now on CI!

Previously,  `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`

however, with this change, any extra module that is included
in your `configuration.nix` file by the means of

```
  imports = [ ./rootfs.nix ]
```

will also be included the generated documentation.

Example output:

```
OPTIONS
       You can use the following options in configuration.nix.

       arian.rootfs.device
           The device that contains the btrfs volume

           Type: string

           Declared by:
               /home/arian/Projects/nixos-stuff/computers/t430s/rootfs.nix

       boot.enableContainers
           Whether to enable support for nixos containers.

           Type: boolean

           Default: true

           Declared by:
               <nixpkgs/nixos/modules/virtualisation/containers.nix>
```

I found it useful for my machine to be self-documenting.  It also means
that if you import modules like `gce.nix` or `azure.nix` which aren't in
`module-list.nix`,  documentation is still generated for these modules

cc:  NixOS#11499

- [ ] I have no idea if this patch impacts the way the documentation for https://nixos.org/nixos
is generated. It might.  We should check this.

---
@arianvp arianvp closed this Feb 23, 2019
oxij pushed a commit to oxij/nixpkgs that referenced this pull request Mar 5, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants