Merge pull request #136315 from gpanders/neovim-lua-packages

neovim: allow extra Lua packages

authored by

Matthieu Coudron and committed by
GitHub
433d95ee eb21f8d4

+24
+2
pkgs/applications/editors/neovim/default.nix
··· 50 50 51 51 dontFixCmake = true; 52 52 53 + inherit lua; 54 + 53 55 buildInputs = [ 54 56 gperf 55 57 libtermkey
+11
pkgs/applications/editors/neovim/tests.nix
··· 132 132 extraName = "-pathogen"; 133 133 configure.pathogen.pluginNames = [ "vim-nix" ]; 134 134 }; 135 + 136 + nvimWithLuaPackages = wrapNeovim2 "with-lua-packages" (makeNeovimConfig { 137 + extraLuaPackages = ps: [ps.mpack]; 138 + customRC = '' 139 + lua require("mpack") 140 + ''; 141 + }); 142 + 143 + nvim_with_lua_packages = runTest nvimWithLuaPackages '' 144 + ${nvimWithLuaPackages}/bin/nvim -i NONE --noplugin -es 145 + ''; 135 146 })
+11
pkgs/applications/editors/neovim/utils.nix
··· 28 28 , extraPython3Packages ? (_: [ ]) 29 29 , withNodeJs ? false 30 30 , withRuby ? true 31 + /* the function you would have passed to lua.withPackages */ 32 + , extraLuaPackages ? (_: [ ]) 31 33 32 34 # expects a list of plugin configuration 33 35 # expects { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; } ··· 76 78 ++ (extraPython3Packages ps) 77 79 ++ (lib.concatMap (f: f ps) pluginPython3Packages)); 78 80 81 + lua = neovim-unwrapped.lua; 82 + luaEnv = lua.withPackages(ps: extraLuaPackages ps); 79 83 80 84 # Mapping a boolean argument to a key that tells us whether to add or not to 81 85 # add to nvim's 'embedded rc' this: ··· 110 114 "--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}" 111 115 ] ++ lib.optionals (binPath != "") [ 112 116 "--suffix" "PATH" ":" binPath 117 + ] ++ lib.optionals (luaEnv != null) [ 118 + "--prefix" "LUA_PATH" ";" "${luaEnv}/share/lua/${lua.luaversion}/?.lua" 119 + "--prefix" "LUA_CPATH" ";" "${luaEnv}/lib/lua/${lua.luaversion}/?.so" 113 120 ]; 114 121 115 122 ··· 123 130 inherit neovimRcContent; 124 131 inherit manifestRc; 125 132 inherit python3Env; 133 + inherit luaEnv; 126 134 inherit withNodeJs; 127 135 } // lib.optionalAttrs withRuby { 128 136 inherit rubyEnv; ··· 143 151 , extraPythonPackages ? (_: []) 144 152 /* the function you would have passed to python.withPackages */ 145 153 , withPython3 ? true, extraPython3Packages ? (_: []) 154 + /* the function you would have passed to lua.withPackages */ 155 + , extraLuaPackages ? (_: []) 146 156 , withNodeJs ? false 147 157 , withRuby ? true 148 158 , vimAlias ? false ··· 159 169 res = makeNeovimConfig { 160 170 inherit withPython3; 161 171 extraPython3Packages = compatFun extraPython3Packages; 172 + inherit extraLuaPackages; 162 173 inherit withNodeJs withRuby viAlias vimAlias; 163 174 inherit configure; 164 175 inherit extraName;