nvf/modules/wrapper/lazy/config.nix

27 lines
605 B
Nix
Raw Normal View History

2024-06-25 15:16:49 +00:00
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
2024-07-09 22:28:18 +00:00
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
2024-06-25 15:16:49 +00:00
cfg = config.vim.lazy;
2024-07-09 22:28:18 +00:00
toLuaLznSpec = name: plugin:
2024-07-09 22:28:18 +00:00
(removeAttrs plugin ["package"])
// {"@1" = name;};
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
2024-06-25 15:16:49 +00:00
in {
config.vim = mkIf cfg.enable {
startPlugins = ["lz-n"];
2024-07-09 22:28:18 +00:00
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
luaConfigRC.lzn-load = entryAnywhere ''
require('lz.n').load(${toLuaObject lznSpecs})
'';
2024-06-25 15:16:49 +00:00
};
}