From 9a25c8c85efd6733406d311690cb4db4ab17e27d Mon Sep 17 00:00:00 2001 From: teto <886074+teto@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:19:46 +0100 Subject: [PATCH] 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}')"'' ]; }) --- doc/release-notes/rl-2605.section.md | 2 + pkgs/applications/editors/neovim/wrapper.nix | 48 ++++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 91cf656d2938..8e6eaccf150f 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -242,6 +242,8 @@ - `openrgb` was updated to 1.0rc2, which now uses Plugin API version 4. Some existing OpenRGB plugins may be incompatible or require updates. +- 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. + - We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables. - the `autossh-ng` NixOS module was introduced as a simpler alternative to the existing `autossh` module. diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index 5fba635a2c48..f76410f6aa50 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -105,13 +105,16 @@ let packpathDirs.myNeovimPackages = vimPackageInfo.vimPackage; finalPackdir = neovimUtils.packDir packpathDirs; - rcContent = '' - ${luaRcContent} - '' - + lib.optionalString (neovimRcContent' != "") '' - vim.cmd.source "${writeText "init.vim" neovimRcContent'}" - '' - + lib.optionalString autoconfigure (lib.concatStringsSep "\n" vimPackageInfo.pluginAdvisedLua); + rcContent = lib.concatStringsSep "\n" ( + [ + providerLuaRc + ] + ++ lib.optional (luaRcContent != "") luaRcContent + ++ lib.optional (neovimRcContent' != "") '' + vim.cmd.source "${writeText "init.vim" neovimRcContent'}" + '' + ++ lib.optionals autoconfigure vimPackageInfo.pluginAdvisedLua + ); python3Env = lib.warnIf (attrs ? python3Env) @@ -126,12 +129,7 @@ let wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; - generatedWrapperArgs = [ - # vim accepts a limited number of commands so we join all the provider ones - "--add-flags" - ''--cmd "lua ${providerLuaRc}"'' - ] - ++ + generatedWrapperArgs = lib.optionals ( finalAttrs.packpathDirs.myNeovimPackages.start != [ ] @@ -143,17 +141,17 @@ let "--add-flags" ''--cmd "set rtp^=${finalPackdir}"'' ] - ++ lib.optionals finalAttrs.withRuby [ - "--set" - "GEM_HOME" - "${rubyEnv}/${rubyEnv.ruby.gemPath}" - ] - ++ lib.optionals (finalAttrs.runtimeDeps != [ ]) [ - "--suffix" - "PATH" - ":" - (lib.makeBinPath finalAttrs.runtimeDeps) - ]; + ++ lib.optionals finalAttrs.withRuby [ + "--set" + "GEM_HOME" + "${rubyEnv}/${rubyEnv.ruby.gemPath}" + ] + ++ lib.optionals (finalAttrs.runtimeDeps != [ ]) [ + "--suffix" + "PATH" + ":" + (lib.makeBinPath finalAttrs.runtimeDeps) + ]; providerLuaRc = let @@ -201,7 +199,7 @@ let ++ lib.optionals finalAttrs.wrapRc [ "--set-default" "VIMINIT" - "lua dofile('${writeText "init.lua" rcContent}')" + "lua dofile('${writeText "init.lua" finalAttrs.luaRcContent}')" ] ++ finalAttrs.generatedWrapperArgs;