neovim: allow extra Lua packages

launchpad/nixpkgs/master
Gregory Anders 3 years ago
parent b9f6f7b1d3
commit 8477406018
  1. 2
      pkgs/applications/editors/neovim/default.nix
  2. 11
      pkgs/applications/editors/neovim/tests.nix
  3. 11
      pkgs/applications/editors/neovim/utils.nix

@ -50,6 +50,8 @@ in
dontFixCmake = true;
inherit lua;
buildInputs = [
gperf
libtermkey

@ -132,4 +132,15 @@ rec {
extraName = "-pathogen";
configure.pathogen.pluginNames = [ "vim-nix" ];
};
nvimWithLuaPackages = wrapNeovim2 "with-lua-packages" (makeNeovimConfig {
extraLuaPackages = ps: [ps.mpack];
customRC = ''
lua require("mpack")
'';
});
nvim_with_lua_packages = runTest nvimWithLuaPackages ''
${nvimWithLuaPackages}/bin/nvim -n -i NONE --noplugin -es
'';
})

@ -28,6 +28,8 @@ let
, extraPython3Packages ? (_: [ ])
, withNodeJs ? false
, withRuby ? true
/* the function you would have passed to lua.withPackages */
, extraLuaPackages ? (_: [ ])
# expects a list of plugin configuration
# expects { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; }
@ -76,6 +78,8 @@ let
++ (extraPython3Packages ps)
++ (lib.concatMap (f: f ps) pluginPython3Packages));
lua = neovim-unwrapped.lua;
luaEnv = lua.withPackages(ps: extraLuaPackages ps);
# Mapping a boolean argument to a key that tells us whether to add or not to
# add to nvim's 'embedded rc' this:
@ -110,6 +114,9 @@ let
"--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}"
] ++ lib.optionals (binPath != "") [
"--suffix" "PATH" ":" binPath
] ++ lib.optionals (luaEnv != null) [
"--prefix" "LUA_PATH" ";" "${luaEnv}/share/lua/${lua.luaversion}/?.lua"
"--prefix" "LUA_CPATH" ";" "${luaEnv}/lib/lua/${lua.luaversion}/?.so"
];
@ -123,6 +130,7 @@ let
inherit neovimRcContent;
inherit manifestRc;
inherit python3Env;
inherit luaEnv;
inherit withNodeJs;
} // lib.optionalAttrs withRuby {
inherit rubyEnv;
@ -143,6 +151,8 @@ let
, extraPythonPackages ? (_: [])
/* the function you would have passed to python.withPackages */
, withPython3 ? true, extraPython3Packages ? (_: [])
/* the function you would have passed to lua.withPackages */
, extraLuaPackages ? (_: [])
, withNodeJs ? false
, withRuby ? true
, vimAlias ? false
@ -159,6 +169,7 @@ let
res = makeNeovimConfig {
inherit withPython3;
extraPython3Packages = compatFun extraPython3Packages;
inherit extraLuaPackages;
inherit withNodeJs withRuby viAlias vimAlias;
inherit configure;
inherit extraName;

Loading…
Cancel
Save