neovim: set provider configuration to initrc#487390
Conversation
|
for context, I would like to make it possible for home-manager to just skip wrapping |
| generatedWrapperArgs = [ | ||
| # vim accepts a limited number of commands so we join all the provider ones | ||
| "--add-flags" | ||
| ''--cmd "lua ${providerLuaRc}"'' | ||
| ] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
nope the same code is included in the generated rcContent instead https://github.com/NixOS/nixpkgs/pull/487390/changes#diff-647e8d1c5843195e278d71753f17d2183d961166104c8c55edc4cb93768579ddR108
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Maybe i'm being overly cautious @mrcjkb any thoughts?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :
- mention who might be concerned ( which I think is really a small number)
- how to fix that in those degenerate cases
36cd4d9 to
ee3a3d3
Compare
16ae792 to
b2c0d1a
Compare
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390
|
while I think the change is fine for nxipkgs users, it's a bit annoying in home-manager so I will reference it in the nixpkgs changelog. Also I need to complete nix-community/home-manager#8734 before merge |
Ok, I will mark this PR as draft in the meantime. |
b2c0d1a to
362a1fa
Compare
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}')"'' ]; })
neovim: avoid creating empty newlines
362a1fa to
28b5fc1
Compare
ty I should have done so. Putting it out of draft since I've fixed the issues in the HM PR. It took me more time than I wanted but it's an iterative progress as we try not to break configs. I've suffered from (my) poor naming choice in the wrapper variables, so some notes for possible naming improvements:
|
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390
|
This change breaks my config because the Contents of the file But it should refer to the neovim store path itself, not the So now in neovim I get the error 'E319: No "python3" provider found.' |
|
ty for warning. If you dont need the python provider, you can disable it via |
|
Yes thank you, I'll just revert to earlier version, no problem. But I send this comment because probably more vim users will get this error, so I was wondering if this could be fixed or otherwise if the commit could be reverted. And thank you for the effort with this PR and cleaning up the vim configuration :). |
|
The problem seems to be that ...which now evaluates to |
We used to unconditionnally wrap the provider configuration. NixOS#487390 tries to "smartly" embed it into init.lua but that breaks neovim legacy behavior in some cases since `wrapRc` is set to false in absence of user configuration. One day we will get rid of the legacy wrapper but until then keep that behavior.
We used to unconditionnally wrap the provider configuration. NixOS#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.
We used to unconditionnally wrap the provider configuration. NixOS#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.
I can think of other solutions though, like inlining the code. EDIT: found the button |
We used to unconditionnally wrap the provider configuration. NixOS#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.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/neovim-provider-options-not-working/76077/2 |
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390
We used to unconditionnally wrap the provider configuration. NixOS#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.
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
We used to unconditionnally wrap the provider configuration. NixOS#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.
We used to unconditionnally wrap the provider configuration. NixOS#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.
We used to unconditionnally wrap the provider configuration. NixOS#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.
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
now that home-manager always generates an init.lua we can take the wrapper output instead of reimplemnting stuff in HM (notwithstanding rtp changes that are not needed in HM). This is necessary to keep the provider configuration available after this change NixOS/nixpkgs#487390 Also updated test to reflect ruby disabling
Things done
as an attempt to simplify configuration. Third parties can just refer to the generated init.lua instead of having to refer to it + regenerate the wrapper arguments (ruby still needs special treatement via GEM_HOME set apparently).
I wonder if this needs release notes, I dont know if nixvim / kickcats depend on the nixpkgs wrapper or if it just rewrites the whole logic.
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.