diff --git a/docs/default.nix b/docs/default.nix index ae65ba1f..e17db082 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -40,8 +40,6 @@ let pkgs = pkgsDoc; }; - inherit (helpers.modules) specialArgs; - nixvimPath = toString ./..; gitHubDeclaration = user: repo: branch: subpath: { @@ -66,18 +64,20 @@ let ) opt.declarations; }; - modules = [ - ../modules/top-level - { isDocs = true; } - ]; + evaledModules = lib.evalModules { + inherit (helpers.modules) specialArgs; + modules = [ + ../modules/top-level + { isDocs = true; } + ]; + }; - hmOptions = builtins.removeAttrs (lib.evalModules { - modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ]; - }).options [ "_module" ]; + hmOptions = builtins.removeAttrs (lib.evalModules { modules = [ ../wrappers/modules/hm.nix ]; }) + .options [ "_module" ]; options-json = (pkgsDoc.nixosOptionsDoc { - inherit (lib.evalModules { inherit modules specialArgs; }) options; + inherit (evaledModules) options; inherit transformOptions; warningsAreErrors = false; }).optionsJSON; @@ -105,12 +105,7 @@ in # Do not check if documentation builds fine on darwin as it fails: # > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535) docs = pkgsDoc.callPackage ./mdbook { - inherit - modules - hmOptions - transformOptions - specialArgs - ; + inherit evaledModules hmOptions transformOptions; # TODO: Find how to handle stable when 24.11 lands search = mkSearch "/nixvim/search/"; }; diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index 10234c47..47805d78 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -1,18 +1,15 @@ { pkgs, lib, - modules, + evaledModules, nixosOptionsDoc, transformOptions, hmOptions, search, - specialArgs, }: with lib; let - options = lib.evalModules { inherit modules specialArgs; }; - - inherit (options.config.meta) nixvimInfo; + inherit (evaledModules.config.meta) nixvimInfo; mkMDDoc = options: @@ -62,7 +59,7 @@ let moduleDoc = let info = optionalAttrs (hasAttrByPath path nixvimInfo) (getAttrFromPath path nixvimInfo); - maintainers = lib.unique (options.config.meta.maintainers.${info.file} or [ ]); + maintainers = lib.unique (evaledModules.config.meta.maintainers.${info.file} or [ ]); maintainersNames = builtins.map maintToMD maintainers; maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name; in @@ -179,7 +176,7 @@ let recurse modules; docs = rec { - modules = processModulesRec (removeUnwanted options.options); + modules = processModulesRec (removeUnwanted evaledModules.options); commands = mapModulesToString ( name: opts: let