modules/nixvim-info: flatten and simplify

Instead of recursively merging a nested tree, construct a flat map of
"option-path" → {info}.

This should be more efficient to eval, and simpler to introspect.
This commit is contained in:
Matt Sturgeon 2026-06-20 17:32:50 +01:00
parent c7ccb896eb
commit f60bf47332
2 changed files with 13 additions and 17 deletions

View file

@ -96,7 +96,8 @@ let
path = removeWhitespace (lib.concatStringsSep "/" path);
docSummaryMD =
let
info = lib.attrByPath path { } nixvimInfo;
pathstr = lib.showOption path;
info = nixvimInfo.${pathstr} or { };
maintainers = lib.unique (configuration.config.meta.maintainers.${info.file} or [ ]);
maintainersNames = map maintToMD maintainers;
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;

View file

@ -21,22 +21,17 @@
# }
merge =
_: defs:
lib.foldl'
(
acc: def:
lib.recursiveUpdate acc (
lib.setAttrByPath def.value.path {
inherit (def) file;
url = def.value.url or null;
description = def.value.description or null;
}
)
)
{
plugins = { };
colorschemes = { };
}
defs;
builtins.listToAttrs (
map ({ file, value }: {
name = lib.showOption value.path;
value = {
inherit file;
inherit (value) path;
url = value.url or null;
description = value.description or null;
};
}) defs
);
};
internal = true;
default = null;