From 3da0a55c9ffcea18dd6366706cedaa83ea3c2a6c Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Sat, 28 Dec 2024 21:45:50 +0100 Subject: [PATCH] neovim: expose runtimeDeps it mimics vimPlugins runtimeDeps. It is useful for the home-manager (HM) usecase where we dont want to use the generated wrapper as is, yet we need some information generated by it, such as the runtime deps. --- pkgs/applications/editors/neovim/wrapper.nix | 53 ++++++++++---------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index a277d18d5d12..f8e5fc9ad1fd 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -123,32 +123,21 @@ let wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; - generatedWrapperArgs = let - 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 - [ - "--add-flags" ''--cmd "lua ${providerLuaRc}"'' - ] - ++ lib.optionals (packpathDirs.myNeovimPackages.start != [] || packpathDirs.myNeovimPackages.opt != []) [ - "--add-flags" ''--cmd "set packpath^=${finalPackdir}"'' - "--add-flags" ''--cmd "set rtp^=${finalPackdir}"'' - ] - ++ lib.optionals finalAttrs.withRuby [ - "--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}" - ] ++ lib.optionals (binPath != "") [ - "--suffix" "PATH" ":" binPath - ] - ; + generatedWrapperArgs = + [ + # vim accepts a limited number of commands so we join all the provider ones + "--add-flags" ''--cmd "lua ${providerLuaRc}"'' + ] + ++ lib.optionals (finalAttrs.packpathDirs.myNeovimPackages.start != [] || finalAttrs.packpathDirs.myNeovimPackages.opt != []) [ + "--add-flags" ''--cmd "set packpath^=${finalPackdir}"'' + "--add-flags" ''--cmd "set rtp^=${finalPackdir}"'' + ] + ++ lib.optionals finalAttrs.withRuby [ + "--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}" + ] ++ lib.optionals (finalAttrs.runtimeDeps != []) [ + "--suffix" "PATH" ":" (lib.makeBinPath finalAttrs.runtimeDeps) + ] + ; providerLuaRc = neovimUtils.generateProviderRc { inherit (finalAttrs) withPython3 withNodeJs withPerl withRuby; @@ -182,6 +171,18 @@ let inherit autoconfigure autowrapRuntimeDeps wrapRc providerLuaRc packpathDirs; inherit python3Env rubyEnv; inherit wrapperArgs generatedWrapperArgs; + + + runtimeDeps = let + op = acc: normalizedPlugin: acc ++ normalizedPlugin.plugin.runtimeDeps or []; + runtimeDeps = lib.foldl' op [] pluginsNormalized; + in + lib.optional finalAttrs.withRuby rubyEnv + ++ lib.optional finalAttrs.withNodeJs nodejs + ++ lib.optionals finalAttrs.autowrapRuntimeDeps runtimeDeps + ; + + luaRcContent = rcContent; # Remove the symlinks created by symlinkJoin which we need to perform # extra actions upon