Project-based, modular Neovim configuration via NixVim.
Nvimx provides many presets based on different language (lsp, treesitter) support and different uses, allowing you to choose what is installed on a neovim instance per project. Works well with direnv.
Nvimx exports these module/package presets:
default/base- Base Neovim instance, contains all plugins, no language support. All other presets automatically includes this base.- Languages (ts = treesitter):
- Use a packaged presets (i.e. via
nix shell):
nix shell github:allen-liaoo/nvimx#{preset}- Construct a module in a flake (i.e. in
devShells). Nvimx flake outputsmakeNixvimWithModule (system: nixvimModule: ...)to be used in this case. Presents have options undernvimx.${preset}, and need to be opted in withnvimx.${preset}.enable = true.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nvimx = {
url = "github:allen-liaoo/nvimx";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixvim }: let
in {
devShells = let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in ${system}.default = pkgs.mkShell (let
nixvimModule = {
# enable the presets you want to use
nvimx.typst.enable = true;
# or add custom nixvim or nvimx options here
plugins.xyz.enable = true;
};
nixvimPkg = nvimx.makeNixvimWithModule system nixvimModule; # package it!
in {
packages = [ nixvimPkg ];
});
};
}Inspired by ar-at-localhost/np.