nix-darwin
nix-darwin copied to clipboard
Support including user modules when generating documentation (e.g. manpage)
nix-darwin generates a configuration.nix manpage that lists all (non-internal, visible) options. Unfortunately it only lists options from the base nix-darwin set and ignores all user modules.
NixOS has a documentation.nixos.includeAllModules config option that, if set, causes NixOS to include user modules in the generated documentation. This was introduced in NixOS 19.09. It currently defaults to false, though the commit that introduced it (https://github.com/NixOS/nixpkgs/pull/56020/commits/2e75a7b516581bedcf236a0f21730185a9d1f11b) said it should be set to true in "a release or two".
I would really love it if nix-darwin could support this same option (well, probably called documentation.darwin.includeAllModules). I add documentation strings to my own internal modules and I really want man configuration.nix to work for those.
On this topic, the NixOS documentation module has seen other enhancements too since nix-darwin copied it. It may be a good idea to pull in the other stuff too. I'm not sure how many old nixpkgs releases nix-darwin needs to support, so perhaps the current state of the module on master can't be copied directly (e.g. it uses extendModules which is relatively recent), but the documentation.nix from 21.11 might work.
I agree this would be nice. @lilyball, do you wanna give it a shot?