diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix index fb89d47aceb0..8f14fd8556ff 100644 --- a/pkgs/applications/editors/neovim/tests/default.nix +++ b/pkgs/applications/editors/neovim/tests/default.nix @@ -170,12 +170,24 @@ in ''; nvim_with_autoconfigure = pkgs.neovim.overrideAttrs(oa: { - plugins = [ vimPlugins.unicode-vim ]; + plugins = [ + vimPlugins.unicode-vim + vimPlugins.fzf-hoogle-vim + ]; autoconfigure = true; # legacy wrapper sets it to false wrapRc = true; }); + nvim_with_runtimeDeps = pkgs.neovim.overrideAttrs({ + plugins = [ + pkgs.vimPlugins.hex-nvim + ]; + autowrapRuntimeDeps = true; + # legacy wrapper sets it to false + wrapRc = true; + }); + nvim_with_ftplugin = let # this plugin checks that it's ftplugin/vim.tex is loaded before $VIMRUNTIME/ftplugin/vim.tex # $VIMRUNTIME/ftplugin/vim.tex sources $VIMRUNTIME/ftplugin/initex.vim which sets b:did_ftplugin @@ -334,7 +346,6 @@ in ${nvim_with_opt_plugin}/bin/nvim -i NONE +quit! -e ''; - inherit nvim-with-luasnip; autoconfigure = runTest nvim_with_autoconfigure '' assertFileContains \ @@ -342,11 +353,18 @@ in '${vimPlugins.unicode-vim.passthru.initLua}' ''; + autowrap_runtime_deps = runTest nvim_with_runtimeDeps '' + assertFileContains \ + "${nvim_with_runtimeDeps}/bin/nvim" \ + '${pkgs.xxd}/bin' + ''; + + inherit nvim-with-luasnip; # check that bringing in one plugin with lua deps makes those deps visible from wrapper # for instance luasnip has a dependency on jsregexp can_require_transitive_deps = runTest nvim-with-luasnip '' - cat ${nvim-with-luasnip}/bin/nvim + cat ${nvim-with-luasnip}/nvim ${nvim-with-luasnip}/bin/nvim -i NONE --cmd "lua require'jsregexp'" -e +quitall! ''; diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index d7b3c322b562..a277d18d5d12 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -24,6 +24,10 @@ let # to work with nix. # if true, the wrapper automatically appends those snippets when necessary , autoconfigure ? false + + # append to PATH runtime deps of plugins + , autowrapRuntimeDeps ? false + # should contain all args but the binary. Can be either a string or list , wrapperArgs ? [] , withPython2 ? false @@ -120,7 +124,15 @@ let wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; generatedWrapperArgs = let - binPath = lib.makeBinPath (lib.optional finalAttrs.withRuby rubyEnv ++ lib.optional finalAttrs.withNodeJs nodejs); + op = acc: normalizedPlugin: acc ++ normalizedPlugin.plugin.runtimeDeps or []; + + runtimeDeps = lib.foldl' op [] pluginsNormalized; + + binPath = lib.makeBinPath ( + lib.optional finalAttrs.withRuby rubyEnv + ++ lib.optional finalAttrs.withNodeJs nodejs + ++ lib.optionals finalAttrs.autowrapRuntimeDeps runtimeDeps + ); in # vim accepts a limited number of commands so we join them all @@ -167,7 +179,7 @@ let __structuredAttrs = true; dontUnpack = true; inherit viAlias vimAlias withNodeJs withPython3 withPerl withRuby; - inherit autoconfigure wrapRc providerLuaRc packpathDirs; + inherit autoconfigure autowrapRuntimeDeps wrapRc providerLuaRc packpathDirs; inherit python3Env rubyEnv; inherit wrapperArgs generatedWrapperArgs; luaRcContent = rcContent; diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index aa01f5548a37..1530e2f009c3 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -1285,9 +1285,7 @@ in }; hex-nvim = super.hex-nvim.overrideAttrs { - postPatch = '' - substituteInPlace lua/hex.lua --replace xxd ${xxd}/bin/xxd - ''; + runtimeDeps = [ xxd ]; nvimRequireCheck = "hex"; };