$ nix run github:gvolpe/neovim-flake
By default, LSP support is enabled for Scala, Dhall, Elm, Nix, and Smithy.
To save you CPU resources and time, you can add the following binary cache to your ~/.config/nix/nix.conf
:
substituters = https://cache.garnix.io trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
Those only interested in Scala LSP support can try the more lightweight versions.
$ nix run github:gvolpe/neovim-flake#scala $ nix run github:gvolpe/neovim-flake#scala-rose-pine $ nix run github:gvolpe/neovim-flake#scala-tokyo-night
The default theme is onedark
with transparency enabled, but there are other flavors.
You may also try Neovim nightly version.
$ nix run github:gvolpe/neovim-flake#scala-nightly
Those only interested in Haskell LSP support can try the exclusive version.
$ nix run github:gvolpe/neovim-flake#haskell
Haskell LSP requires a lot of packages, so expect a heavy build or download if you are leveraging the binary cache. For this reason, Haskell is disabled in the default IDE configuration.
The Home Manager module allows us to customize the different vim
options. To use it, we first add the input flake.
{ neovim-flake = { url = github:gvolpe/neovim-flake; inputs.nixpkgs.follows = "nixpkgs"; }; }
Followed by importing the HM module.
{ imports = [ neovim-flake.homeManagerModules.default ]; }
Then we should be able to use the given module. E.g.
{ programs.neovim-ide = { enable = true; settings = { vim.viAlias = false; vim.vimAlias = true; vim.lsp = { enable = true; }; }; }; }
Besides the classic Appendix A, Configuration options, you can also use the searchable module options.
For the Scala module, the metals
binary can be easily overridden with the provided builder. E.g.
{ vim.lsp = { enable = true; scala = { enable = true; metals = pkgs.metalsBuilder { version = "0.11.8+76-22425a8b-SNAPSHOT"; outputHash = "[Insert hash (try nix build .#)]"; }; }; }; }
It enables the featureful and recommended nvim-metals.
To use metalsBuilder
, you need to add the following overlay.
{ pkgs = import nixpkgs { inherit system; overlays = [ neovim-flake.overlays.default ]; }; }
You can have a look at my nix-config for a full example.
Besides the full-fledged IDE and HM modules, there are a few packages exposed that may prove useful to your use case.
ts-scala
: tree-sitter-scala version that tracks the latest master changes.
nvim-treesitter
: latest nvim-treesitter ensuring compatibility with tree-sitter-scala
.
If you have your own NeoVim configuration, you can still leverage nvim-treesitter
by first adding the overlay, and then using the following package.
{ programs.neovim = { enable = true; plugins = [ pkgs.neovimPlugins.nvim-treesitter ]; }; }
Or more directly without the overlay.
{ programs.neovim = { enable = true; plugins = [ inputs.neovim-flake.packages.${system}.nvim-treesitter ]; }; }
You can see all the enabled grammars for this package here.
The ts-scala
package only builds tree-sitter-scala
from master
, but it wouldn’t be as useful for your own configuration because nvim-treesitter
requires a few tweaks.
Furthermore, the generated neovimRC
and luaRC
files for every flavor of Neovim exposed by this flake are also available as derivations for better visibility.
ide-lua-rc
ide-neovim-rc
haskell-lua-rc
haskell-neovim-rc
scala-lua-rc
scala-neovim-rc
These could also be useful to debug when plugins don’t work as expected.