diff --git a/modules/top-level/output.nix b/modules/top-level/output.nix index 06b8d90b..93e0aed1 100644 --- a/modules/top-level/output.nix +++ b/modules/top-level/output.nix @@ -95,6 +95,13 @@ in }) ) allPlugins; + # Python3 dependencies from all plugins + python3Dependencies = + let + deps = map (p: p.python3Dependencies or (_: [ ])) allPluginsOverrided; + in + ps: builtins.concatMap (f: f ps) deps; + # Combine all plugins into a single pack pluginPack = pkgs.vimUtils.toVimPlugin ( pkgs.buildEnv { @@ -106,6 +113,9 @@ in find $out -type d -empty -delete runHook preFixup ''; + passthru = { + inherit python3Dependencies; + }; } ); diff --git a/tests/test-sources/modules/performance/combine-plugins.nix b/tests/test-sources/modules/performance/combine-plugins.nix index 8a084923..c9bec0d6 100644 --- a/tests/test-sources/modules/performance/combine-plugins.nix +++ b/tests/test-sources/modules/performance/combine-plugins.nix @@ -102,4 +102,31 @@ } ]; }; + + # Test that plugin python3 dependencies are handled + python-dependencies.module = + { config, ... }: + { + performance.combinePlugins.enable = true; + extraPlugins = with pkgs.vimPlugins; [ + # No python3 dependencies + plenary-nvim + # Duplicate python3 dependencies + (nvim-lspconfig.overrideAttrs { passthru.python3Dependencies = ps: [ ps.pyyaml ]; }) + (nvim-treesitter.overrideAttrs { passthru.python3Dependencies = ps: [ ps.pyyaml ]; }) + # Another python3 dependency + (nvim-cmp.overrideAttrs { passthru.python3Dependencies = ps: [ ps.requests ]; }) + ]; + extraConfigLuaPost = '' + -- Python modules are importable + vim.cmd.py3("import yaml") + vim.cmd.py3("import requests") + ''; + assertions = [ + { + assertion = builtins.length config.finalPackage.packpathDirs.myNeovimPackages.start == 1; + message = "More than one plugin is defined in packpathDirs."; + } + ]; + }; }