modules/output: obtain plugin configs from wrapped neovim

The official method for obtaining the generated initRc content is from
wrapped neovim rather than from makeNeovimConfig helper. To use this
approach: first wrap neovim with the generated config, then override it
with our wrapperArgs.
This commit is contained in:
Stanislav Asunkin 2024-10-13 09:54:05 +03:00
parent ba77e88740
commit 767eb62f48
2 changed files with 12 additions and 10 deletions

View file

@ -285,8 +285,10 @@ in
} }
); );
wrappedNeovim' = pkgs.wrapNeovimUnstable package neovimConfig;
customRC = helpers.concatNonEmptyLines [ customRC = helpers.concatNonEmptyLines [
(helpers.wrapVimscriptForLua neovimConfig.neovimRcContent) (helpers.wrapVimscriptForLua wrappedNeovim'.initRc)
config.content config.content
]; ];
@ -330,13 +332,13 @@ in
else else
config.package; config.package;
wrappedNeovim = pkgs.wrapNeovimUnstable package ( wrappedNeovim = wrappedNeovim'.override (prev: {
neovimConfig wrapperArgs =
// { (if lib.isString prev.wrapperArgs then prev.wrapperArgs else lib.escapeShellArgs prev.wrapperArgs)
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs; + " "
wrapRc = false; + extraWrapperArgs;
} wrapRc = false;
); });
in in
{ {
build = { build = {

View file

@ -48,7 +48,7 @@
extraPlugins = [ extraPlugins = [
{ {
config = "let g:var = 'neovimRcContent5'"; config = "let g:var = 'wrappedNeovim.initRc5'";
# Test that final init.lua contains all config sections # Test that final init.lua contains all config sections
plugin = pkgs.runCommandLocal "init-lua-content-test" { } '' plugin = pkgs.runCommandLocal "init-lua-content-test" { } ''
@ -63,7 +63,7 @@
test_content extraConfigLua2 extraConfigLua test_content extraConfigLua2 extraConfigLua
test_content extraConfigLuaPost3 extraConfigLuaPost test_content extraConfigLuaPost3 extraConfigLuaPost
test_content extraConfigVim4 extraConfigVim4 test_content extraConfigVim4 extraConfigVim4
test_content neovimRcContent5 neovimRcContent test_content wrappedNeovim.initRc5 wrappedNeovim.initRc
touch $out touch $out
''; '';