nixvim
nixvim copied to clipboard
Don't expose gcc on the PATH after starting nvim
The plugin rust-analyzer adds gcc to the $PATH.
If we open a terminal inside neovim, and run cargo build/cargo test etc, it will fail if the project depends on various dynamically linked libraries (e.g. if using diesel, which links dynamically the C header files) because obviously the headers of those libs are outside /nix/store.
Fixes I've tried and worked:
- manually remove the nix's gcc from the
$PATH(but you have to do this in every terminal instance you open in neovim) - write
build.rsto inform the compiler and linker where various system libs are installed
Fix I'm proposing:
- don't expose the gcc from nix on the $PATH when starting neovim, if possible
I realise that gcc gets added to the $PATH by rust-analyzer, not by nixvim, but can still be removed by nixvim afterwards, unless there's a concern that doing so may break rust-analyzer.