Skip to content

Commit 9a25c8c

Browse files
committed
neovim: move provider configuration to initrc
instead of wrapping arguments when possible. As an attempt to simplify configuration: instead of having wrapping arguments + an optional neovim configuration let's always generate a neovim configuration. The change should be transparent for most users, and require intervention for users that fulfill both conditions: - using remote plugins (rare already) - that set `wrapRc = false` in wrapNeovimUnstable without loading later the generated luaRcContent The fix is then to pass as wrapping arguments the wrapper's generated config via (wrapNeovimUnstable neovim-unwrapped { } ).overrideAttrs(oa: { wrapperArgs = oa.wrapperArgs ++ [ ''--cmd "lua dofile('${writeText "init.lua" oa.luaRcContent}')"'' ]; })
1 parent 56cb048 commit 9a25c8c

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

doc/release-notes/rl-2605.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@
242242
- `openrgb` was updated to 1.0rc2, which now uses Plugin API version 4.
243243
Some existing OpenRGB plugins may be incompatible or require updates.
244244
245+
- the `neovim` wrapper sets provider-related configuration in its generated config rather than as wrapper arguments. It should not affect configuration unless you set `wrapRc` to false.
246+
245247
- We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables.
246248
247249
- the `autossh-ng` NixOS module was introduced as a simpler alternative to the existing `autossh` module.

pkgs/applications/editors/neovim/wrapper.nix

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,16 @@ let
105105
packpathDirs.myNeovimPackages = vimPackageInfo.vimPackage;
106106
finalPackdir = neovimUtils.packDir packpathDirs;
107107

108-
rcContent = ''
109-
${luaRcContent}
110-
''
111-
+ lib.optionalString (neovimRcContent' != "") ''
112-
vim.cmd.source "${writeText "init.vim" neovimRcContent'}"
113-
''
114-
+ lib.optionalString autoconfigure (lib.concatStringsSep "\n" vimPackageInfo.pluginAdvisedLua);
108+
rcContent = lib.concatStringsSep "\n" (
109+
[
110+
providerLuaRc
111+
]
112+
++ lib.optional (luaRcContent != "") luaRcContent
113+
++ lib.optional (neovimRcContent' != "") ''
114+
vim.cmd.source "${writeText "init.vim" neovimRcContent'}"
115+
''
116+
++ lib.optionals autoconfigure vimPackageInfo.pluginAdvisedLua
117+
);
115118

116119
python3Env =
117120
lib.warnIf (attrs ? python3Env)
@@ -126,12 +129,7 @@ let
126129

127130
wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs;
128131

129-
generatedWrapperArgs = [
130-
# vim accepts a limited number of commands so we join all the provider ones
131-
"--add-flags"
132-
''--cmd "lua ${providerLuaRc}"''
133-
]
134-
++
132+
generatedWrapperArgs =
135133
lib.optionals
136134
(
137135
finalAttrs.packpathDirs.myNeovimPackages.start != [ ]
@@ -143,17 +141,17 @@ let
143141
"--add-flags"
144142
''--cmd "set rtp^=${finalPackdir}"''
145143
]
146-
++ lib.optionals finalAttrs.withRuby [
147-
"--set"
148-
"GEM_HOME"
149-
"${rubyEnv}/${rubyEnv.ruby.gemPath}"
150-
]
151-
++ lib.optionals (finalAttrs.runtimeDeps != [ ]) [
152-
"--suffix"
153-
"PATH"
154-
":"
155-
(lib.makeBinPath finalAttrs.runtimeDeps)
156-
];
144+
++ lib.optionals finalAttrs.withRuby [
145+
"--set"
146+
"GEM_HOME"
147+
"${rubyEnv}/${rubyEnv.ruby.gemPath}"
148+
]
149+
++ lib.optionals (finalAttrs.runtimeDeps != [ ]) [
150+
"--suffix"
151+
"PATH"
152+
":"
153+
(lib.makeBinPath finalAttrs.runtimeDeps)
154+
];
157155

158156
providerLuaRc =
159157
let
@@ -201,7 +199,7 @@ let
201199
++ lib.optionals finalAttrs.wrapRc [
202200
"--set-default"
203201
"VIMINIT"
204-
"lua dofile('${writeText "init.lua" rcContent}')"
202+
"lua dofile('${writeText "init.lua" finalAttrs.luaRcContent}')"
205203
]
206204
++ finalAttrs.generatedWrapperArgs;
207205

0 commit comments

Comments
 (0)