mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
docs: call evalModules
in one place
This commit is contained in:
parent
27c4c9c210
commit
0bc1699037
2 changed files with 15 additions and 23 deletions
|
@ -40,8 +40,6 @@ let
|
||||||
pkgs = pkgsDoc;
|
pkgs = pkgsDoc;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (helpers.modules) specialArgs;
|
|
||||||
|
|
||||||
nixvimPath = toString ./..;
|
nixvimPath = toString ./..;
|
||||||
|
|
||||||
gitHubDeclaration = user: repo: branch: subpath: {
|
gitHubDeclaration = user: repo: branch: subpath: {
|
||||||
|
@ -66,18 +64,20 @@ let
|
||||||
) opt.declarations;
|
) opt.declarations;
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
evaledModules = lib.evalModules {
|
||||||
../modules/top-level
|
inherit (helpers.modules) specialArgs;
|
||||||
{ isDocs = true; }
|
modules = [
|
||||||
];
|
../modules/top-level
|
||||||
|
{ isDocs = true; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
hmOptions = builtins.removeAttrs (lib.evalModules {
|
hmOptions = builtins.removeAttrs (lib.evalModules { modules = [ ../wrappers/modules/hm.nix ]; })
|
||||||
modules = [ (import ../wrappers/modules/hm.nix { inherit lib; }) ];
|
.options [ "_module" ];
|
||||||
}).options [ "_module" ];
|
|
||||||
|
|
||||||
options-json =
|
options-json =
|
||||||
(pkgsDoc.nixosOptionsDoc {
|
(pkgsDoc.nixosOptionsDoc {
|
||||||
inherit (lib.evalModules { inherit modules specialArgs; }) options;
|
inherit (evaledModules) options;
|
||||||
inherit transformOptions;
|
inherit transformOptions;
|
||||||
warningsAreErrors = false;
|
warningsAreErrors = false;
|
||||||
}).optionsJSON;
|
}).optionsJSON;
|
||||||
|
@ -105,12 +105,7 @@ in
|
||||||
# Do not check if documentation builds fine on darwin as it fails:
|
# Do not check if documentation builds fine on darwin as it fails:
|
||||||
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
# > sandbox-exec: pattern serialization length 69298 exceeds maximum (65535)
|
||||||
docs = pkgsDoc.callPackage ./mdbook {
|
docs = pkgsDoc.callPackage ./mdbook {
|
||||||
inherit
|
inherit evaledModules hmOptions transformOptions;
|
||||||
modules
|
|
||||||
hmOptions
|
|
||||||
transformOptions
|
|
||||||
specialArgs
|
|
||||||
;
|
|
||||||
# TODO: Find how to handle stable when 24.11 lands
|
# TODO: Find how to handle stable when 24.11 lands
|
||||||
search = mkSearch "/nixvim/search/";
|
search = mkSearch "/nixvim/search/";
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
modules,
|
evaledModules,
|
||||||
nixosOptionsDoc,
|
nixosOptionsDoc,
|
||||||
transformOptions,
|
transformOptions,
|
||||||
hmOptions,
|
hmOptions,
|
||||||
search,
|
search,
|
||||||
specialArgs,
|
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
options = lib.evalModules { inherit modules specialArgs; };
|
inherit (evaledModules.config.meta) nixvimInfo;
|
||||||
|
|
||||||
inherit (options.config.meta) nixvimInfo;
|
|
||||||
|
|
||||||
mkMDDoc =
|
mkMDDoc =
|
||||||
options:
|
options:
|
||||||
|
@ -62,7 +59,7 @@ let
|
||||||
moduleDoc =
|
moduleDoc =
|
||||||
let
|
let
|
||||||
info = optionalAttrs (hasAttrByPath path nixvimInfo) (getAttrFromPath path nixvimInfo);
|
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;
|
maintainersNames = builtins.map maintToMD maintainers;
|
||||||
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;
|
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;
|
||||||
in
|
in
|
||||||
|
@ -179,7 +176,7 @@ let
|
||||||
recurse modules;
|
recurse modules;
|
||||||
|
|
||||||
docs = rec {
|
docs = rec {
|
||||||
modules = processModulesRec (removeUnwanted options.options);
|
modules = processModulesRec (removeUnwanted evaledModules.options);
|
||||||
commands = mapModulesToString (
|
commands = mapModulesToString (
|
||||||
name: opts:
|
name: opts:
|
||||||
let
|
let
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue