TIL: how to generate NixOS module docs

11 Likes

you can avoid splitting your modules into multiple files by setting check = false on evalModules, or in the newer style adding a module that sets _module.check = false. that’s how the docs system is able to cache most of the collected options documentation without needing this split; we simply skip the consistency checks since we don’t need them.

7 Likes

Good to know!

After splitting them out I have to admit I kinda like the separation. I’ll be sure to make an edit over the weekend though to point out that it’s not strictly necessary.

Thanks @pennae! Useful information and will make a great update to the blog post.

I couldn’t tolerate knowing I was spreading mis-information so I went ahead and added the correction :wink:

Thanks again @pennae

2 Likes

Before I found _module.check = false I used this trick:

lib.evalModules {
  modules = [ 
    (args: {
      inherit (import ./module.nix args) options;
    })
  ];
}

Is there any difference? What the check option is affecting?