# Installation You must use a `nixpkgs` version compatible with the nixvim version you choose. The `main` branch requires to use a _very recent_ version of nixpkgs unstable. In order to guarantee the compatibility between nixvim & nixpkgs it is recommended to always update both at the same time. When using a `stable` version you must use the corresponding nixvim branch, for example `nixos-25.05` when using NixOS 25.05. Failure to use the correct branch, or an old revision of nixpkgs will likely result in errors of the form `vimPlugins. attribute not found`. NixVim can be used in four ways: - As a NixOS module - As a Home-Manager module - As a nix-darwin module - As a standalone derivation NixVim is also available for nix flakes, or directly through an import. ## Accessing nixvim For a direct import you can add nixvim to your configuration as follows: ```nix let nixvim = import (builtins.fetchGit { url = "https://github.com/nix-community/nixvim"; # When using a different channel you can use `ref = "nixos-"` to set it here }); in ``` When using flakes you can simply add `nixvim` to the inputs: ```nix { inputs.nixvim = { url = "github:nix-community/nixvim"; # If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-"` inputs.nixpkgs.follows = "nixpkgs"; }; # outputs... } ``` ## Usage NixVim can be used standalone or as a module for NixOS, home-manager, or nix-darwin. When used standalone, a custom NixVim derivation is produced that can be used like any other package. When used as a module, NixVim can be enabled though `programs.nixvim.enable`. ### Usage as a module (NixOS, home-manager, nix-darwin) When using NixVim as a module you must import the NixVim module into your module system. The three imports are: - `.homeModules.nixvim` - `.nixosModules.nixvim` - `.nixDarwinModules.nixvim` `` refers to the way to access nixvim, depending on how you fetched nixvim as described in the previous section. The imports can be added as a `imports = [ ]` in a configuration file. You will then be able to enable nixvim through `programs.nixvim.enable = true`, and configure the options as `programs.nixvim...