diff --git a/pkgs/applications/editors/neovim/module.nix b/pkgs/applications/editors/neovim/module.nix index 41b56b81113d..258352c4e41b 100644 --- a/pkgs/applications/editors/neovim/module.nix +++ b/pkgs/applications/editors/neovim/module.nix @@ -13,7 +13,7 @@ let optional = false; }; in - map (x: defaultPlugin // (if (x ? plugin) then x else { plugin = x; })) plugins; + map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) plugins; pluginWithConfigType = with lib; @@ -78,17 +78,26 @@ in userPluginViml = lib.mkOption { readOnly = true; - type = lib.types.listOf (lib.types.lines); + type = lib.types.listOf lib.types.lines; description = '' The viml config set by the user. ''; }; + pluginPython3Packages = lib.mkOption { + readOnly = true; + type = lib.types.listOf (lib.types.functionTo (lib.types.listOf lib.types.package)); + example = lib.literalExpression "[ (ps: [ ps.python-language-server ]) ]"; + description = '' + Packages required by the plugins to work with the python3 provider. + ''; + }; + }; config = let - pluginsNormalized = normalizePlugins config.plugins; + pluginsNormalized = config.plugins; in { pluginAdvisedLua = @@ -111,5 +120,7 @@ in userPluginViml = lib.foldl ( acc: p: if p.config != null then acc ++ [ p.config ] else acc ) [ ] pluginsNormalized; + + pluginPython3Packages = map (plugin: plugin.python3Dependencies or (_: [ ])) pluginsNormalized; }; } diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index a358b96a3ba2..df9411ca269d 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -99,24 +99,19 @@ let inherit plugins; }; - pluginsNormalized = normalizePlugins plugins; + pluginsNormalized = checked_cfg.plugins; vimPackage = normalizedPluginsToVimPackage pluginsNormalized; - getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ])); - - requiredPlugins = vimUtils.requiredPluginsForPackage vimPackage; - pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins; in { - # plugins' python dependencies - inherit pluginPython3Packages; # viml config set by the user along with the plugin inherit (checked_cfg) userPluginViml runtimeDeps pluginAdvisedLua + pluginPython3Packages ; # A Vim "package", see ':h packages'