Writing Nix code is a hassle, with all these available options and stuff, I use neovim as my code editor and I would like to know if there’s any LSP not just for formatting or for the Nix language basics but also for suggesting available options and stuff
In the making, see x.com
3 Likes
nixd provides support for options, eval errors, etc. This is probably what you are looking for:
3 Likes
super interested in this project : D
Ik you bro, you got a youtube channel, W vids also thanks for your help : )
1 Like
Both nixd
and nil
support completion for NixOS options (nixd
also supports Home Manager!), but also error checks, lints, code refactor commands and all the stuff regular programming language tooling have whereas devenv lsp
seems to be only intended to provide completions for Devenv’s own module system.
4 Likes
nil doesn’t work for me so that’s why I was looking for some alternatives, and this is what I had to settle with for now:
local lspconfig = require("lspconfig")
lspconfig.nixd.setup {}
-- other stuff
if server == "nil_ls" then
lspconfig.nil_ls.setup({
settings = {
['nil'] = {
formatting = {
command = { "nixfmt" }, -- nixfmt available on nixpkgs and this is what I use for formatting
},
},
},
})