diff --git a/modules/wrapper/lazy/config.nix b/modules/wrapper/lazy/config.nix index 53df6ae..a2bd73a 100644 --- a/modules/wrapper/lazy/config.nix +++ b/modules/wrapper/lazy/config.nix @@ -3,12 +3,26 @@ config, ... }: let + inherit (builtins) toJSON; inherit (lib.modules) mkIf; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.generators) mkLuaInline; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.lazy; + + toLznSpec = name: plugin: + (removeAttrs plugin ["package"]) + // {__HACK = mkLuaInline "nil, [1] = ${toJSON name}";}; + lznSpecs = mapAttrsToList toLznSpec cfg.plugins; in { config.vim = mkIf cfg.enable { startPlugins = ["lz-n"]; - # optPlugins = + optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins; + + luaConfigRC.lzn-load = entryAnywhere '' + require('lz.n').load(${toLuaObject lznSpecs}) + ''; }; }