From f60bf47332d1564a175ad4b517a83ff0c288f2e7 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 20 Jun 2026 17:32:50 +0100 Subject: [PATCH] modules/nixvim-info: flatten and simplify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- docs/mdbook/default.nix | 3 ++- modules/misc/nixvim-info.nix | 27 +++++++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index 0040796f..b383475c 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -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; diff --git a/modules/misc/nixvim-info.nix b/modules/misc/nixvim-info.nix index 219f9202..f3936e08 100644 --- a/modules/misc/nixvim-info.nix +++ b/modules/misc/nixvim-info.nix @@ -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;