I’ve got a global configuration for my nixvim in my home manager configuration.
Now, I’d like to build project-specific versions for projects I’m managing in flakes with direnv.
Crucially, most plugins and config are supposed to be the same for all projects, it’s usually just the LSP and maybe one or two specific configurations that each project needs.
Aside from it being cleaner if I don’t have dependencies on, say, Haskell, globally, I also have different projects in the same language with different toolchain versions, which necessitates using different package versions in nixvim.
Is there a way to do this more gracefully than just copy-pasting the global nixvim config into each flake and then tweaking it?
I’m unsure how NixVim+direnv handles this, but you should be able to get direnv-based toolchains into your Neovim’s PATH so it will use their LSPs.
I use direnv.vim for this with my nix-wrapper-modules based Neovim setup:
exrc might also help too.
If you really need this though, factor your Nixvim config so that you can use it like the standalone usage example, with 1 entrypoint nix file in modules:
Then add your config flake as an input to your devshell, do another nixvim.lib.evalNixvim with modules as inputs.your-config + "/nixvim/default.nix" (or something along those lines) and a module with whatever overrides you want.