2024-06-25 17:16:49 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2024-07-10 00:28:18 +02:00
|
|
|
inherit (builtins) toJSON;
|
2024-06-25 17:16:49 +02:00
|
|
|
inherit (lib.modules) mkIf;
|
2024-07-10 00:28:18 +02:00
|
|
|
inherit (lib.attrsets) mapAttrsToList;
|
|
|
|
inherit (lib.generators) mkLuaInline;
|
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-06-25 17:16:49 +02:00
|
|
|
cfg = config.vim.lazy;
|
2024-07-10 00:28:18 +02:00
|
|
|
|
|
|
|
toLznSpec = name: plugin:
|
|
|
|
(removeAttrs plugin ["package"])
|
|
|
|
// {__HACK = mkLuaInline "nil, [1] = ${toJSON name}";};
|
|
|
|
lznSpecs = mapAttrsToList toLznSpec cfg.plugins;
|
2024-06-25 17:16:49 +02:00
|
|
|
in {
|
|
|
|
config.vim = mkIf cfg.enable {
|
|
|
|
startPlugins = ["lz-n"];
|
|
|
|
|
2024-07-10 00:28:18 +02:00
|
|
|
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
|
|
|
|
|
|
|
|
luaConfigRC.lzn-load = entryAnywhere ''
|
|
|
|
require('lz.n').load(${toLuaObject lznSpecs})
|
|
|
|
'';
|
2024-06-25 17:16:49 +02:00
|
|
|
};
|
|
|
|
}
|