# What does documentation.nixos.includeAllModules actually do?

**URL:** https://discourse.nixos.org/t/what-does-documentation-nixos-includeallmodules-actually-do/47703
**Category:** Help
**Created:** [June 26, 2024, 2:57pm UTC](https://discourse.nixos.org/t/what-does-documentation-nixos-includeallmodules-actually-do/47703 "2024-06-26T14:57:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![l0b0](https://discourse.nixos.org/user_avatar/discourse.nixos.org/l0b0/32/39028_2.png) [@l0b0](https://discourse.nixos.org/u/l0b0)
#### Post date: [June 26, 2024, 2:57pm UTC](https://discourse.nixos.org/t/what-does-documentation-nixos-includeallmodules-actually-do/47703/1 "2024-06-26T14:57:55Z")

</div>

After setting this option ([recommended elsewhere](https://discourse.nixos.org/t/some-manpage-related-stuff-you-might-want-to-turn-on/38835)) my build starts failing with

> function ‘anonymous lambda’ called with unexpected argument ‘utils’

in any one of several files included in my configuration. Before figuring out whether this is worth fixing, I tried looking at its [description](https://search.nixos.org/options?channel=24.05&show=documentation.nixos.includeAllModules&from=0&size=50&sort=relevance&type=packages&query=includeAllModules), but that’s not very helpful. What does it actually do? And what is `baseModules`?

I’ve looked for all the relevant keywords (“utils”, “baseModules”, “base modules”) in [The NixOS manual](https://nixos.org/manual/nixos/stable/) and the [NixOS modules wiki page](https://wiki.nixos.org/wiki/NixOS_modules), without finding anything.

---

<div class="post-metadata">

### Author: ![Zocker1999NET](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zocker1999NET](https://discourse.nixos.org/u/Zocker1999NET)
#### Post date: [January 9, 2025, 12:35pm UTC](https://discourse.nixos.org/t/what-does-documentation-nixos-includeallmodules-actually-do/47703/2 "2025-01-09T12:35:27Z")

</div>

Probably one of those cases where looking into the code is the only chance to grasp exactly what happens. I haven’t done that myself in this case, but I think I can say a lot from my own experience.

I’m unsure where to start, so just in case:  
The `documentation.nixos` options are controlling if and what is included in the NixOS manual built into your own system. Essentially it is the same as [the official one](https://nixos.org/manual/nixos/stable/). In its [appendix](https://nixos.org/manual/nixos/stable/options) (or also in `man configuration.nix`) you will find a list of nearly all(\*) available options.

These are a lot of options, mostly unmaintained until something breaks or needs expansion. This includes something simple as options having broken descriptions, types or defaults. And because of Nix lazy evaluation, these errors are hidden until the option is actually required for building your system.

So, for building the options list, the doc builder reuses the module system, iterates over every option, and by that triggers the evaluation of every option’s description, type and default. And funny enough, if an option is set, you do not need to evaluate its description, default and not even a type’s human description. This makes it really easy to define options, which work for system evaluation but which cannot be rendered into the docs.

In my experience most (maybe all) official NixOS modules should have a working documentation (from [this](https://github.com/NixOS/nixpkgs/blob/b5a8b3b141dd31f96db77a13e034a114c4517781/nixos/lib/eval-config.nix#L22) I assume `baseModules` includes all official NixOS modules), but non-official 3rd-party modules tend to have broken documentation. So to make it possible for you to have a basic documentation on your systems while using 3rd-party modules, you can restrict the docs to the `baseModules`.

But, to make it more weird: your whole configuration is also a module. And e.g. in case of an option A not defining `defaultText` but having a default depending on another option B, the doc will reflect the _actual_ value of B as A‘s default. (In these cases, `defaultText` of B should also be set.) Your configuration is not a `baseModule` so this can only be happen with `includeAllModules` enabled, as the doc-builder can then no longer differentiate between “module modules” and “your config module(s)”.

For completeness: the release notes of 19.09 mentioned [here](https://nixos.org/manual/nixos/stable/release-notes#sec-release-19.09-notable-changes) that `includeAllModules` was seen as experimental because even official modules had broken documentation. I assume/hope this has changed in the last 5 years.

PS: In my experience, an option’s default is most often the culprit, as it can be that the default works just fine with _other_ options set, but not when all options have only their defaults configured. That’s one reason why options can define a `defaultText` attribute to overwrite what is rendered into the docs.

(Disclaimer for anyone: this is CC-0, feel free to copy/reuse for publishing it in the wiki or elsewhere.)
