File tree 2 files changed +54
-4
lines changed
modules/top-level/plugins
tests/test-sources/modules/performance
2 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 35
35
paths = overriddenPlugins ;
36
36
inherit pathsToLink ;
37
37
38
- # Remove empty directories and activate vimGenDocHook
39
- # TODO: figure out why we are running the `preFixup` hook in `postBuild`
38
+ # buildEnv uses runCommand under the hood. runCommand doesn't run any build phases.
39
+ # To run custom commands buildEnv takes postBuild argument.
40
+ # fixupPhase is used for propagating build inputs and to trigger vimGenDocHook
40
41
postBuild = ''
41
42
find $out -type d -empty -delete
42
- runHook preFixup
43
+ fixupPhase
43
44
'' ;
44
45
passthru = {
45
46
inherit python3Dependencies ;
46
47
} ;
47
48
}
48
49
) ;
49
50
51
+ # propagatedBuildInputs contain lua dependencies
52
+ propagatedBuildInputs = lib . pipe pluginsToCombine [
53
+ ( builtins . catAttrs "plugin" )
54
+ ( builtins . catAttrs "propagatedBuildInputs" )
55
+ builtins . concatLists
56
+ lib . unique
57
+ ] ;
58
+ finalCombinedPlugin = combinedPlugin . overrideAttrs { inherit propagatedBuildInputs ; } ;
59
+
50
60
# Combined plugin configs
51
61
combinedConfig = lib . pipe pluginsToCombine [
52
62
( builtins . catAttrs "config" )
55
65
] ;
56
66
in
57
67
normalizePlugin {
58
- plugin = combinedPlugin ;
68
+ plugin = finalCombinedPlugin ;
59
69
config = combinedConfig ;
60
70
}
Original file line number Diff line number Diff line change 69
69
pluginWithPyDeps3 = mkPlugin "plugin-with-py-deps-3" {
70
70
passthru . python3Dependencies = ps : [ ps . requests ] ;
71
71
} ;
72
+ # Plugins with Lua dependencies
73
+ ensureDep =
74
+ drv : dep :
75
+ drv . overrideAttrs ( prev : {
76
+ propagatedBuildInputs = lib . unique (
77
+ prev . propagatedBuildInputs or [ ] ++ [ prev . passthru . lua . pkgs . ${ dep } ]
78
+ ) ;
79
+ } ) ;
80
+ pluginWithLuaDeps1 = ensureDep pkgs . vimPlugins . telescope-nvim "plenary-nvim" ;
81
+ pluginWithLuaDeps2 = ensureDep pkgs . vimPlugins . nvim-cmp "plenary-nvim" ;
82
+ pluginWithLuaDeps3 = ensureDep pkgs . vimPlugins . gitsigns-nvim "nui-nvim" ;
72
83
in
73
84
{
74
85
# Test basic functionality
216
227
] ;
217
228
} ;
218
229
230
+ # Test that plugin lua dependencies are handled
231
+ lua-dependencies =
232
+ { config , ... } :
233
+ {
234
+ performance . combinePlugins . enable = true ;
235
+ extraPlugins = [
236
+ simplePlugin1
237
+ # Duplicated plenary-nvim dependency
238
+ pluginWithLuaDeps1
239
+ pluginWithLuaDeps2
240
+ # nui-nvim dependency
241
+ pluginWithLuaDeps3
242
+ ] ;
243
+ extraConfigLuaPost = ''
244
+ -- All packages and its dependencies are importable
245
+ require("telescope")
246
+ require("plenary")
247
+ require("cmp")
248
+ require("gitsigns")
249
+ require("nui.popup")
250
+ '' ;
251
+ assertions = [
252
+ {
253
+ assertion = pluginCount config . build . nvimPackage config . build . extraFiles "start" == 1 ;
254
+ message = "More than one plugin is defined in packpathDirs." ;
255
+ }
256
+ ] ;
257
+ } ;
258
+
219
259
# Test that optional plugins are handled
220
260
optional-plugins =
221
261
{ config , ... } :
You can’t perform that action at this time.
0 commit comments