Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release-notes/rl-2605.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,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.
## Nixpkgs Library {#sec-nixpkgs-release-26.05-lib}
Expand Down
48 changes: 23 additions & 25 deletions pkgs/applications/editors/neovim/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,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)
Expand All @@ -125,12 +128,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}"''
]
Comment on lines -128 to -132

@khaneliman khaneliman Feb 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the result of losing these providerLuaRc variables for a downstream consumer of the wrapper?

Before:

exec "/nix/store/wr7j2629j0hmipa1mb966xagk174q5ky-neovim-byte-compiled-0.11.6/bin/nvim"  --cmd "lua
vim.g.loaded_node_provider=0;vim.g.loaded_perl_provider=0;vim.g.loaded_python_provider=0;vim.g.python3_host_prog='/nix/store/c4bfr9cl8nmlggzjg40q3z5pvalpgpkz-neovim-0.11.6/bin/nvim-python3';vim.g.ruby_host_prog='/nix/store/c4bfr9cl8nmlggzjg40q3z5pvalpgpkz-neovim-0.11.6/bin/nvim-ruby'" --cmd "set packpath^=/nix/store/q8cjdv0idypwjypmai84mg4g1pymws3a-vim-pack-dir" --cmd "set rtp^=/nix/store/q8cjdv0idypwjypmai84mg4g1pymws3a-vim-pack-dir" -u
/nix/store/g8d7m5y1alrh0w71phig6kyah9q2b66v-init.lua "$@"

After:

exec "/nix/store/wr7j2629j0hmipa1mb966xagk174q5ky-neovim-byte-compiled-0.11.6/bin/nvim"  --cmd "set packpath^=/nix/store/xssf72bmwy0pqhb8sk4rz3djs4nww7rp-vim-pack-dir" --cmd "set
rtp^=/nix/store/xssf72bmwy0pqhb8sk4rz3djs4nww7rp-vim-pack-dir" -u /nix/store/86sl0w2kp7f6hm6vqhhpqb75gvy5lfhn-init.lua "$@"

Is this just going to make Neovim search for those on PATH instead of automatically including the direct paths?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e a plain user should not see the difference, someone setting wrapRc = false will be fine if he already includes the wrapper luaRcContent somehow. If he doesn't, now he must :p

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what I was trying to figure out was, this is technically a breaking change that generates a different wrapper for those relying on it from there. What is the effect of that no longer being included in the wrapper and / or recommended migration for consumers of the existing wrapper semantics?

Should probably have a short blurb in release notes about the behavior changing so there's something to reference if a config stops working how it had before the change.

Just trying to avoid surprising people with undocumented changes if they will affect neovim at runtime.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe i'm being overly cautious @mrcjkb any thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, the neovim wrapper was invoked with

nvim --cmd ":lua ${providerLuaRc}" "$@"

--cmd flags are invoked after init.lua (you can test this by adding vim.g.foo = "hello" to your init.lua and then running nvim --cmd ":lua vim.print(vim.g.foo or 'foo unset')").

So this PR moves the sourcing of the providerLuaRc to an earlier point of Neovim's startup sequence.

Technically, a config could break if it tries to use one of the providers in the init.lua and the user doesn't know that they have it disabled.
I think it's highly unlikely, as providers are typically used by plugins and Neovim loads providers lazily using :h autoload scripts.
For example, the python provider is only loaded if a user or a plugin calls the Vimscript function provider#python3#Call or provider#python3#Require.

@teto teto Feb 12, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything setting the providers earlier could fix things where a plugin checks if the provider is set (and currently thinks it's not). I doubt many users use remote plugins. With the remark of marc, I've updated the commit description to :

  1. mention who might be concerned ( which I think is really a small number)
  2. how to fix that in those degenerate cases

++
generatedWrapperArgs =
lib.optionals
(
finalAttrs.packpathDirs.myNeovimPackages.start != [ ]
Expand All @@ -142,17 +140,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 = neovimUtils.generateProviderRc {
inherit (finalAttrs)
Expand Down Expand Up @@ -181,7 +179,7 @@ let
++ lib.optionals finalAttrs.wrapRc [
"--set-default"
"VIMINIT"
"lua dofile('${writeText "init.lua" rcContent}')"
"lua dofile('${writeText "init.lua" finalAttrs.luaRcContent}')"
]
++ finalAttrs.generatedWrapperArgs;

Expand Down
Loading