{ pkgs # Note, this should be "the standard library" + HM extensions. , lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib }: let nmdSrc = fetchTarball { url = "https://git.sr.ht/~rycee/nmd/archive/89a4092ea397642ca1d5712d4af62f8a4daae184.tar.gz"; sha256 = "0p1c8lwz33myqpirk4bh9vhfkgg0h9zwks0kfaj4siaivc4wjgvs"; }; nmd = import nmdSrc { inherit lib pkgs; }; # Make sure the used package is scrubbed to avoid actually # instantiating derivations. scrubbedPkgsModule = { imports = [{ _module.args = { pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs); pkgs_i686 = lib.mkForce { }; }; }]; }; dontCheckDefinitions = { _module.check = false; }; buildModulesDocs = args: nmd.buildModulesDocs ({ moduleRootPaths = [ ./.. ]; mkModuleUrl = path: "https://github.com/nix-community/home-manager/blob/master/${path}#blob-path"; channelName = "home-manager"; } // args); hmModulesDocs = buildModulesDocs { modules = import ../modules/modules.nix { inherit lib pkgs; check = false; } ++ [ scrubbedPkgsModule ]; docBook.id = "home-manager-options"; }; nixosModuleDocs = buildModulesDocs { modules = [ ../nixos scrubbedPkgsModule dontCheckDefinitions ]; docBook = { id = "nixos-options"; optionIdPrefix = "nixos-opt"; }; }; nixDarwinModuleDocs = buildModulesDocs { modules = [ ../nix-darwin scrubbedPkgsModule dontCheckDefinitions ]; docBook = { id = "nix-darwin-options"; optionIdPrefix = "nix-darwin-opt"; }; }; docs = nmd.buildDocBookDocs { pathName = "home-manager"; projectName = "Home Manager"; modulesDocs = [ hmModulesDocs nixDarwinModuleDocs nixosModuleDocs ]; documentsDirectory = ./.; documentType = "book"; chunkToc = '' ''; }; in { inherit nmdSrc; options = { json = hmModulesDocs.json.override { path = "share/doc/home-manager/options.json"; }; }; manPages = docs.manPages; manual = { inherit (docs) html htmlOpenTool; }; # Unstable, mainly for CI. jsonModuleMaintainers = pkgs.writeText "hm-module-maintainers.json" (let result = lib.evalModules { modules = import ../modules/modules.nix { inherit lib pkgs; check = false; } ++ [ scrubbedPkgsModule ]; }; in builtins.toJSON result.config.meta.maintainers); }