diff --git a/docs/docgen.nix b/docs/docgen.nix index 20f230c..a1b37b9 100644 --- a/docs/docgen.nix +++ b/docs/docgen.nix @@ -2,6 +2,7 @@ stdenvNoCC, mdbook, nixdoc, + nixosOptionsDoc, lib, excluded ? [ ".*flake\\.nix$" @@ -45,8 +46,9 @@ stdenvNoCC.mkDerivation { docs = 0; flake = 1; devShells = 2; - hosts = 3; - users = 4; + modules = 3; + hosts = 4; + users = 5; }; order = orderMap.${lib.head (lib.splitString "/" (relPath file))}; @@ -66,6 +68,18 @@ stdenvNoCC.mkDerivation { in if dirPart == "." then 0 else lib.length (lib.splitString "/" dirPart); indent = lib.concatStringsSep "" (lib.genList (x: " ") depth); + + isModule = (r: lib.hasPrefix "modules/os" r || lib.hasPrefix "modules/home" r) relPath; + modulesEval = lib.evalModules { + modules = [ + file + { _module.check = false; } + ]; + }; + moduleOptionsDoc = + (nixosOptionsDoc { + options = lib.removeAttrs modulesEval.options [ "_module" ]; + }).optionsCommonMark; in { script = '' @@ -76,6 +90,12 @@ stdenvNoCC.mkDerivation { --description "${title}" \ --anchor-prefix "" \ --file "${file}" > "src/${mdPath}" + '' + + lib.optionalString isModule '' + { + echo + cat ${moduleOptionsDoc} + } >> src/${mdPath} ''; summaryLine = "${indent}- [${title}](${mdPath})"; sortKey = toString order + mdPath;