Can you integrate with nix flakes from your favorite editor?

Hey!

I’m curious how nix flakes work together with people’s editors.

I would like people to be able to use their favorite editing tools (neovim, vscode etc.) while still being able to levarage nix flakes for building and running the software. For example, am I able to still have LSP features and my neovim config running on the nix instance as other people? Can other developers make use of their vscode setup? Can they do this without touching the flake.nix?

2 Likes

@Marcc I like where you are going with this. Could you clarify a bit more what you are asking, though:

  • are you asking if one can edit flakes with their favorite editor?
  • or are you, as I suspect, asking if you can configure Neovim or VSCode via flakes?

I can’t speak to VSCode, but I use Neovim, with LSPs, all configured with home-manager, and it appears to be working great so far. I use flakes.

Have you been able to configure Neovim with nix?

1 Like

For the specific example of vscod{e,ium}, the Nix VSCode Extensions project allows exactly this: a vscode instance, with declared extensions and config, as part of your project devshell. There’s a flake template provided for this.

1 Like

There are direnv plugins for both Emacs and Neovim and between the two plus nix-direnv this has been sufficient for my needs for years.

2 Likes

Personally, with emacs, nix-direnv works well, but nix build completely breaks all the compilation-mode regexes by prepending ${derivation-name}> so jumping to compilation errors is borked.

Still haven’t found a fix all these years later, no way to prepend something to the regexes in bulk afaict and no good way to change the output either.

2 Likes