File tree Expand file tree Collapse file tree 2 files changed +70
-16
lines changed
modules/top-level/plugins
tests/test-sources/modules/performance Expand file tree Collapse file tree 2 files changed +70
-16
lines changed Original file line number Diff line number Diff line change 28
28
( builtins . concatMap ( f : f ps ) )
29
29
] ;
30
30
31
+ # propagatedBuildInputs contain lua dependencies
32
+ propagatedBuildInputs = lib . pipe pluginsToCombine [
33
+ ( builtins . catAttrs "plugin" )
34
+ ( builtins . catAttrs "propagatedBuildInputs" )
35
+ builtins . concatLists
36
+ lib . unique
37
+ ] ;
38
+
31
39
# Combined plugin
32
- combinedPlugin = pkgs . vimUtils . toVimPlugin (
33
- pkgs . buildEnv {
34
- name = "plugin-pack" ;
35
- paths = overriddenPlugins ;
36
- inherit pathsToLink ;
40
+ combinedPlugin =
41
+ lib . pipe
42
+ {
43
+ name = "plugin-pack" ;
44
+ paths = overriddenPlugins ;
45
+ inherit pathsToLink ;
37
46
38
- # Remove empty directories and activate vimGenDocHook
39
- # TODO: figure out why we are running the `preFixup` hook in `postBuild`
40
- postBuild = ''
41
- find $out -type d -empty -delete
42
- runHook preFixup
43
- '' ;
44
- passthru = {
45
- inherit python3Dependencies ;
46
- } ;
47
- }
48
- ) ;
47
+ # buildEnv uses runCommand under the hood. runCommand doesn't run any build phases.
48
+ # To run custom commands buildEnv takes postBuild argument.
49
+ # fixupPhase is used for propagating build inputs and to trigger vimGenDocHook
50
+ postBuild = ''
51
+ find $out -type d -empty -delete
52
+ fixupPhase
53
+ '' ;
54
+ passthru = {
55
+ inherit python3Dependencies ;
56
+ } ;
57
+ }
58
+ [
59
+ pkgs . buildEnv
60
+ pkgs . vimUtils . toVimPlugin
61
+ ( drv : drv . overrideAttrs { inherit propagatedBuildInputs ; } )
62
+ ] ;
49
63
50
64
# Combined plugin configs
51
65
combinedConfig = lib . pipe pluginsToCombine [
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
222
233
] ;
223
234
} ;
224
235
236
+ # Test that plugin lua dependencies are handled
237
+ lua-dependencies =
238
+ { config , ... } :
239
+ {
240
+ performance . combinePlugins . enable = true ;
241
+ extraPlugins = [
242
+ simplePlugin1
243
+ # Duplicated plenary-nvim dependency
244
+ pluginWithLuaDeps1
245
+ pluginWithLuaDeps2
246
+ # nui-nvim dependency
247
+ pluginWithLuaDeps3
248
+ ] ;
249
+ extraConfigLuaPost = ''
250
+ -- All packages and its dependencies are importable
251
+ require("telescope")
252
+ require("plenary")
253
+ require("cmp")
254
+ require("gitsigns")
255
+ require("nui.popup")
256
+ '' ;
257
+ assertions = [
258
+ {
259
+ assertion = pluginCount config . build . nvimPackage config . build . extraFiles "start" == 1 ;
260
+ message = "More than one plugin is defined in packpathDirs." ;
261
+ }
262
+ ] ;
263
+ } ;
264
+
225
265
# Test that optional plugins are handled
226
266
optional-plugins =
227
267
{ config , ... } :
You can’t perform that action at this time.
0 commit comments