My Nix-based Neovim configuration. For when you have an unhealthy obsession for declarativity and configurability.
Option 1: Clone and run
git clone https://github.com/fred-drake/neovim.git
nix run .#Option 2: Run directly
nix run github:fred-drake/neovim#The default configuration performs editing without settings for any particular language or technology. The following configurations allow for CMP, LSP, Tree-Sitter and DAP in their respective language or technology stack:
- Rust
nix run github:fred-drake/neovim#rust - C#
nix run github:fred-drake/neovim#csharp - Go
nix run github:fred-drake/neovim#golang - Python
nix run github:fred-drake/neovim#python - Javascript
nix run github:fred-drake/neovim#javascript - Infrastructure as Code
nix run github:fred-drake/neovim#iac
You can have multiple neovim configurations (nvim, nvim-rust, nvim-golang, etc). Take a look at my system configuration flake to see how I do this, but here's the gist:
Create a function that creates neovim links with unique configuration names:
mkNeovimPackages = pkgs: neovimPkgs: let
mkNeovimAlias = name: pkg:
pkgs.runCommand "neovim-${name}" {} ''
mkdir -p $out/bin
ln -s ${pkg}/bin/nvim $out/bin/nvim-${name}
'';And add it to your home-manager imports:
({pkgs, ...}: {
home.packages =
(builtins.attrValues (mkNeovimPackages pkgs inputs.neovim.packages.${pkgs.system}))
++ [inputs.neovim.packages.${pkgs.system}.default];
})| Technology | Formatter | Language Server | Debugger | Nix Configuration |
|---|---|---|---|---|
| Nix | alejandra | nil_ls, nixd | default | |
| Just | just | default | ||
| SQL | sqlformat | default | ||
| Lua | stylua | default | ||
| YAML | yamlfmt | yamllint, yamlls | default | |
| CSS | prettier | default | ||
| HTML | prettier | default | ||
| Javascript | prettier | javascript | ||
| Typescript | prettier | javascript | ||
| JSON | prettier | jsonls | default | |
| Markdown | prettier | marksman | default | |
| Ruby | rubyfmt | default | ||
| Terraform | tofu_fmt | default | ||
| TOML | taplo | taplo | default | |
| C# | csharpier | csharp-ls | netcoredbg | csharp |
| Go | golines | gopls | delve | golang |
| Python | black, isort | flake8, jedi, pylint, rope, mccabe | dap-python | python |
| Rust | rustfmt | clippy | lldb | rust |
| Node | prettier | tsserver | vscode-js-debug | javascript |
| Ansible | yamlfmt | ansiblels | iac | |
| Terraform | tofu_fmt | terraformls | iac | |
| Nginx | nginx_language_server | iac | ||
| Helm | helm_ls | iac | ||
| Dockerfile | dockerls | iac |
