diff --git a/pkgs/nixvim/formatting.nix b/pkgs/nixvim/formatting.nix index 7472324..d0c373b 100644 --- a/pkgs/nixvim/formatting.nix +++ b/pkgs/nixvim/formatting.nix @@ -95,7 +95,7 @@ }; } ]; - plugins.conform-nvim = { + youthlic.plugins.conform-nvim = { enable = true; settings.formatters.injected.options.ignore_errors = true; }; diff --git a/pkgs/nixvim/lsp.nix b/pkgs/nixvim/lsp.nix index e8b43ff..018b782 100644 --- a/pkgs/nixvim/lsp.nix +++ b/pkgs/nixvim/lsp.nix @@ -1,5 +1,5 @@ {...}: { - plugins.lspconfig.enable = true; + youthlic.plugins.lspconfig.enable = true; lsp = { inlayHints.enable = true; servers = { diff --git a/pkgs/nixvim/module.nix b/pkgs/nixvim/module.nix new file mode 100644 index 0000000..8426876 --- /dev/null +++ b/pkgs/nixvim/module.nix @@ -0,0 +1,47 @@ +{ + lib, + config, + options, + ... +}: let + cfg = config.youthlic; +in { + options = { + youthlic.plugins = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule ({ + name, + lib, + ... + }: { + freeformType = lib.types.anything; + options = { + enable = lib.mkEnableOption "nvimPlugins.${name}"; + }; + })); + default = {}; + }; + }; + config = let + enabledPlugins = lib.filterAttrs (_name: value: value.enable) cfg.plugins; + in + lib.mkMerge [ + { + plugins = enabledPlugins; + } + { + plugins = lib.pipe enabledPlugins [ + builtins.attrNames + (lib.filter (name: options.plugins.${name} ? luaConfig)) + (map (name: + lib.nameValuePair name { + luaConfig.post = + #lua + '' + _M.load("${name}") + ''; + })) + lib.listToAttrs + ]; + } + ]; +}