deprecate neovimUtils.makeNeovimConfig (#499573)

This commit is contained in:
Matthieu Coudron
2026-03-25 17:21:20 +00:00
committed by GitHub
4 changed files with 43 additions and 63 deletions
+1 -1
View File
@@ -262,7 +262,7 @@
- neovim lua dependencies are now set in the generated init.lua instead of
modifying LUA_PATH in the wrapper. Commands run pre-vimrc via `nvim --cmd
"require'LUA_MODULE'"` may
not find their lua dependencies anymore. Use `nvim -c "lua require'LUA_MODULE'"` instead to run these commands after loading `init.lua`.
not find their lua dependencies anymore. Use `nvim -c "lua require'LUA_MODULE'"` instead to run these commands after loading `init.lua`. If you use `wrapNeovim` with `wrapRc` set to `false`, you may lose the lua dependencies if you are not loading the generated `init.lua`.
- We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables.
@@ -43,27 +43,27 @@ let
}
];
nvimConfSingleLines = makeNeovimConfig {
nvimConfSingleLines = {
plugins = packagesWithSingleLineConfigs;
customRC = ''
neovimRcContent = ''
" just a comment
'';
};
nvimConfNix = makeNeovimConfig {
nvimConfNix = {
inherit plugins;
customRC = ''
neovimRcContent = ''
" just a comment
'';
};
nvim-with-luasnip = wrapNeovim2 "-with-luasnip" (makeNeovimConfig {
nvim-with-luasnip = wrapNeovim2 "-with-luasnip" {
plugins = [
{
plugin = vimPlugins.luasnip;
}
];
});
};
# build should fail with a wrong
nvim-run-failing-check =
@@ -74,8 +74,6 @@ let
doCheck = true;
};
nvimAutoDisableWrap = makeNeovimConfig { };
wrapNeovim2 =
suffix: config:
wrapNeovimUnstable neovim-unwrapped (
@@ -308,15 +306,15 @@ pkgs.lib.recurseIntoAttrs rec {
'';
# nixpkgs should detect that no wrapping is necessary
nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" nvimAutoDisableWrap;
nvimShouldntWrap = wrapNeovim2 "-should-not-wrap" { };
# this will generate a neovimRc content but we disable wrapping
nvimDontWrap = wrapNeovim2 "-forced-nowrap" (makeNeovimConfig {
nvimDontWrap = wrapNeovim2 "-forced-nowrap" {
wrapRc = false;
customRC = ''
neovimRcContent = ''
" this shouldn't trigger the creation of an init.vim
'';
});
};
force-nowrap = runTest nvimDontWrap ''
! grep -F -- ' -u' ${nvimDontWrap}/bin/nvim
+32 -49
View File
@@ -146,45 +146,38 @@ let
let
luaEnv = neovim-unwrapped.lua.withPackages extraLuaPackages;
in
attrs
// {
neovimRcContent = customRC;
luaRcContent =
if attrs ? luaRcContent then
lib.warn "makeNeovimConfig: luaRcContent parameter is deprecated. Please use customLuaRC instead." attrs.luaRcContent
else
customLuaRC;
wrapperArgs = lib.optionals (luaEnv != null) [
"--prefix"
"LUA_PATH"
";"
(neovim-unwrapped.lua.pkgs.luaLib.genLuaPathAbsStr luaEnv)
"--prefix"
"LUA_CPATH"
";"
(neovim-unwrapped.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv)
];
};
lib.warn
"neovimUtils.makeNeovimConfig is deprecated. Use wrapNeovim or wrapNeovimUnstable directly."
(
attrs
// {
neovimRcContent = customRC;
luaRcContent =
if attrs ? luaRcContent then
lib.warn "makeNeovimConfig: luaRcContent parameter is deprecated. Please use customLuaRC instead." attrs.luaRcContent
else
customLuaRC;
wrapperArgs = lib.optionals (luaEnv != null) [
"--prefix"
"LUA_PATH"
";"
(neovim-unwrapped.lua.pkgs.luaLib.genLuaPathAbsStr luaEnv)
"--prefix"
"LUA_CPATH"
";"
(neovim-unwrapped.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv)
];
}
);
# to keep backwards compatibility for people using neovim.override
legacyWrapper =
neovim:
{
extraMakeWrapperArgs ? "",
# the function you would have passed to python.withPackages
extraPythonPackages ? (_: [ ]),
# the function you would have passed to python.withPackages
withPython3 ? false,
extraPython3Packages ? (_: [ ]),
# the function you would have passed to lua.withPackages
extraLuaPackages ? (_: [ ]),
withNodeJs ? false,
withRuby ? false,
vimAlias ? false,
viAlias ? false,
configure ? { },
extraName ? "",
}:
...
}@attrs:
let
# we convert from the old configure.format to
@@ -205,26 +198,16 @@ let
optional = true;
}) opt);
res = makeNeovimConfig {
inherit withPython3;
inherit extraPython3Packages;
inherit extraLuaPackages;
inherit
withNodeJs
withRuby
viAlias
vimAlias
;
customRC = configure.customRC or "";
customLuaRC = configure.customLuaRC or "";
inherit plugins;
inherit extraName;
};
in
wrapNeovimUnstable neovim (
res
attrs
// {
wrapperArgs = lib.escapeShellArgs res.wrapperArgs + " " + extraMakeWrapperArgs;
neovimRcContent = configure.customRC or "";
luaRcContent = configure.customLuaRC or "";
inherit plugins;
wrapperArgs = lib.escapeShellArgs (attrs.wrapperArgs or [ ]) + " " + extraMakeWrapperArgs;
wrapRc = configure != { };
legacyWrapper = true;
}
@@ -51,7 +51,6 @@ let
vimAlias ? false,
viAlias ? false,
# additional argument not generated by makeNeovimConfig
# it sets the VIMINIT environment variable to "lua dofile('${customRc}')"
# set to false if you want to control where to save the generated config
# (e.g., in ~/.config/init.vim or project/.nvimrc)