From 4d7ec078bd08e84e258a3bd04130160161e7023a Mon Sep 17 00:00:00 2001 From: teto <886074+teto@users.noreply.github.com> Date: Thu, 19 Feb 2026 17:10:44 +0100 Subject: [PATCH] neovim: restore provider configuration in legacy mode We used to unconditionnally wrap the provider configuration. https://github.com/NixOS/nixpkgs/pull/487390 "smartly" embeds it into init.lua depending on `wrapRc` but that breaks neovim legacy behavior in some cases since `legacyWrapper` sets `wrapRc` to false in absence of some of user configuration. One day we will get rid of the legacy wrapper but until then keep that behavior. Most of the changes come from linter. --- doc/release-notes/rl-2605.section.md | 2 +- pkgs/applications/editors/neovim/utils.nix | 3 +- pkgs/applications/editors/neovim/wrapper.nix | 30 +++++++++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 8e6eaccf150f..537164f40301 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -242,7 +242,7 @@ - `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. +- `wrapNeovimUnstable` now sets provider-related configuration in its generated config rather than as wrapper arguments. It should not affect configuration unless you set `wrapRc` to false or are using the `legacyWrapper`. - We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables. diff --git a/pkgs/applications/editors/neovim/utils.nix b/pkgs/applications/editors/neovim/utils.nix index df9411ca269d..57ab04f98308 100644 --- a/pkgs/applications/editors/neovim/utils.nix +++ b/pkgs/applications/editors/neovim/utils.nix @@ -223,7 +223,8 @@ let res // { wrapperArgs = lib.escapeShellArgs res.wrapperArgs + " " + extraMakeWrapperArgs; - wrapRc = (configure != { }); + wrapRc = configure != { }; + legacyWrapper = true; } ); diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index f76410f6aa50..c3ec13eec25d 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -130,17 +130,25 @@ let wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; generatedWrapperArgs = - lib.optionals - ( - finalAttrs.packpathDirs.myNeovimPackages.start != [ ] - || finalAttrs.packpathDirs.myNeovimPackages.opt != [ ] - ) - [ - "--add-flags" - ''--cmd "set packpath^=${finalPackdir}"'' - "--add-flags" - ''--cmd "set rtp^=${finalPackdir}"'' - ] + + # neovimUtils.legacyWrapper adds a `legacyWrapper` attribute to let us know we run in "legacy" mode + lib.optionals (attrs ? legacyWrapper) [ + # vim accepts a limited number of commands so we join all the provider ones + "--add-flags" + ''--cmd "lua ${providerLuaRc}"'' + ] + ++ + lib.optionals + ( + finalAttrs.packpathDirs.myNeovimPackages.start != [ ] + || finalAttrs.packpathDirs.myNeovimPackages.opt != [ ] + ) + [ + "--add-flags" + ''--cmd "set packpath^=${finalPackdir}"'' + "--add-flags" + ''--cmd "set rtp^=${finalPackdir}"'' + ] ++ lib.optionals finalAttrs.withRuby [ "--set" "GEM_HOME"