[BUG] `exrc` option not working for `makeNixvimWithModule`?
| Field | Description |
|---|---|
| Nixpkgs | 2631b0b7abcea6e640ce31cd78ea58910d31e650 |
- [x] I have read the FAQ and my bug is not listed there.
Description
Afaik everything necessary to source a local .nvim.lau file is to have the exrc option set and the just run a nvim . in the directory where its placed. However, I can't get the file to be sourced with my nixvim instance using nixvim.makeNixvimWithModule...
Using this option, the file generated and added as nvim to the path is a bash script ending with something like this:
exec "/nix/store/q570k9f80p21sbr4x74vbggjxhg82brz-neovim-unwrapped-0.11.2/bin/nvim" --cmd "lua vim.g.loaded_node_provider=0;vim.g.loaded_perl_provider=0;vim.g.loaded_pytho
n_provider=0;vim.g.loaded_python3_provider=0;vim.g.loaded_ruby_provider=0" --cmd "set packpath^=/nix/store/3wb9jlpx5i85wj4h7y61wwsms2mn7995-vim-pack-dir" --cmd "set rtp^=/n
ix/store/3wb9jlpx5i85wj4h7y61wwsms2mn7995-vim-pack-dir" -u /nix/store/sav787yqb8z271hplrxdfp6rwq7mw5hb-init.lua "$@"
Can anyone confirm or contradict this claim? Would be really nice to know if this is a Nixvim problem or one related to my own config...
Minimal, Reproducible Example (MRE)
programs.nixvim = {
options = {
exrc = true;
secure = true;
};
}
$ l --group .nvim.lua
Permissions Size User Group Date Modified Name
.rw-r--r-- 152 jnnk users 24 Jun 21:14 .nvim.lua
Nixvim uses -u to specify the vimrc lua file, which is incompatible with exrc. This is controlled by our wrapRc option, but is pretty much required outside of home-manager.
Upstream nixpkgs switched from -u to VIMINIT for this reason. Maybe we should do the same?
Thoughts @nix-community/nixvim ?
Nixvim uses
-uto specify the vimrc lua file, which is incompatible with exrc. This is controlled by ourwrapRcoption, but is pretty much required outside of home-manager.Upstream nixpkgs switched from
-utoVIMINITfor this reason. Maybe we should do the same?Thoughts @nix-community/nixvim ?
IIRC, -u brings additional "purity" guarantees, which might be desirable, especially with standalone nixvim builds.
Having said that, I don't feel strongly about this.
IIRC,
-ubrings additional "purity" guarantees
I made the same argument in the nixpkgs PR. IIUC, it turned out that there are only two main differences:
- sysinit (i.e. a system init file, usually in
/etc) - exrc
Both of these count as impurities, because they are loading init config that is unrelated to the nixvim config.
The first one may be solvable in the same way we avoid loading the init file from .config/nvim; manipulating the runtimepath in our impureRtp option. There's some related discussion in #1920.
The second one is explicitly opt-in, so I don't see it as an issue.
Is there at the moment any way to a fix to enable the exrc option on my nixvim closure that works?
I'm also interested in being able to use exrc, additional, per-project config is a common use-case for me