neovim: add extraLuaPackages to wrapNeovimUnstable (#499571)
This commit is contained in:
@@ -64,6 +64,7 @@ For instance, `sqlite-lua` needs `g:sqlite_clib_path` to be set to work. Nixpkgs
|
||||
- `wrapRc`: Nix, not being able to write in your `$HOME`, loads the
|
||||
generated Neovim configuration via the `$VIMINIT` environment variable, i.e. : `export VIMINIT='lua dofile("/nix/store/…-init.lua")'`. This has side effects like preventing Neovim from sourcing your `init.lua` in `$XDG_CONFIG_HOME/nvim` (see bullet 7 of [`:help startup`](https://neovim.io/doc/user/starting.html#startup) in Neovim). Disable it if you want to generate your own wrapper. You can still reuse the generated vimscript init code via `neovim.passthru.initRc`.
|
||||
- `plugins`: A list of plugins to add to the wrapper.
|
||||
- `extraLuaPackages`: A function passed on to `lua.withPackages`
|
||||
- `withPython3`, `withNodeJs`, `withRuby` control when to enable neovim
|
||||
providers (see `:h provider`).
|
||||
|
||||
@@ -90,6 +91,7 @@ wrapNeovimUnstable neovim-unwrapped {
|
||||
(nvim-treesitter.withPlugins (p: [ p.nix p.python ]))
|
||||
hex-nvim
|
||||
];
|
||||
extraLuaPackages = lp: [ lp.mpack ];
|
||||
withPython3 = true;
|
||||
withNodeJs = false;
|
||||
withRuby = false;
|
||||
|
||||
@@ -348,12 +348,12 @@ pkgs.lib.recurseIntoAttrs rec {
|
||||
configure.packages.foo.start = with vimPlugins; [ deoplete-nvim ];
|
||||
};
|
||||
|
||||
nvimWithLuaPackages = wrapNeovim2 "-with-lua-packages" (makeNeovimConfig {
|
||||
nvimWithLuaPackages = wrapNeovim2 "-with-lua-packages" {
|
||||
extraLuaPackages = ps: [ ps.mpack ];
|
||||
customRC = ''
|
||||
lua require("mpack")
|
||||
luaRcContent = ''
|
||||
require("mpack")
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
nvim_with_lua_packages = runTest nvimWithLuaPackages ''
|
||||
${nvimWithLuaPackages}/bin/nvim -V3log.txt -i NONE --noplugin +quitall! -e
|
||||
|
||||
@@ -69,6 +69,8 @@ let
|
||||
# { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; }
|
||||
# ]
|
||||
plugins ? [ ],
|
||||
# the function you would have passed to lua.withPackages
|
||||
extraLuaPackages ? (_: [ ]),
|
||||
...
|
||||
}@attrs:
|
||||
assert
|
||||
@@ -105,8 +107,23 @@ let
|
||||
packpathDirs.myNeovimPackages = vimPackageInfo.vimPackage;
|
||||
finalPackdir = neovimUtils.packDir packpathDirs;
|
||||
|
||||
luaPathLuaRc =
|
||||
let
|
||||
luaEnv = lua.withPackages extraLuaPackages;
|
||||
|
||||
# getLuaPath / getLuaCPath are not interpreter dependant at the moment and might thus cause
|
||||
# errors between luajit/Puc lua
|
||||
generatedLuaPath = lua.pkgs.getLuaPath luaEnv;
|
||||
generatedLuaCPath = lua.pkgs.getLuaCPath luaEnv;
|
||||
in
|
||||
''
|
||||
package.path = "${generatedLuaPath}".. ";" .. package.path
|
||||
package.cpath = "${generatedLuaCPath}".. ";" .. package.cpath
|
||||
'';
|
||||
|
||||
rcContent = lib.concatStringsSep "\n" (
|
||||
[
|
||||
luaPathLuaRc
|
||||
providerLuaRc
|
||||
]
|
||||
++ lib.optional (luaRcContent != "") luaRcContent
|
||||
|
||||
Reference in New Issue
Block a user