Nix Extra
lang.nix adds Nix support through the nil language server with nixfmt
formatting.
Enable it
-- ~/.config/blak/lua/blak/user.luareturn { extras = { enabled = { "lang.nix", }, },}Or enable it interactively:
:BlakExtras enable lang.nixWhat it adds
| Surface | Contribution |
|---|---|
| Treesitter | nix |
| Mason | nixfmt |
| LSP | nil_ls |
| Formatting | nixfmt for nix |
nil_ls installs automatically through Mason (package nil).
Format with alejandra instead
To format with alejandra instead of nixfmt, override the formatter:
return { extras = { enabled = { "lang.nix" } }, mason = { ensure_installed = { "alejandra" } }, format = { formatters_by_ft = { nix = { "alejandra" }, }, },}Install and verify
:BlakToolsInstall:BlakTreesitterInstall:BlakDoctorOpen a .nix file and check :LspInfo for nil.