1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-06 09:01:06 +01:00

treewide: NixVim/nixvim -> Nixvim

Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
saygo-png 2025-12-04 16:36:05 +01:00 committed by Matt Sturgeon
parent 5d1c27e53c
commit 03a51dbf3d
34 changed files with 78 additions and 78 deletions

View file

@ -1,25 +1,25 @@
# Installation
You must use a `nixpkgs` version compatible with the nixvim version you choose.
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.
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.11` when using NixOS 25.11.
When using a `stable` version you must use the corresponding Nixvim branch, for example `nixos-25.11` when using NixOS 25.11.
Failure to use the correct branch, or an old revision of nixpkgs will likely result in errors of the form `vimPlugins.<name> attribute not found`.
NixVim can be used in four ways:
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.
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:
For a direct import you can add Nixvim to your configuration as follows:
```nix
let
nixvim = import (builtins.fetchGit {
@ -45,30 +45,30 @@ When using flakes you can simply add `nixvim` to the inputs:
## Usage
NixVim can be used standalone or as a module for NixOS, Home Manager, or nix-darwin.
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 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`.
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.
When using Nixvim as a module you must import the Nixvim module into your module system.
The three imports are:
- `<nixvim>.homeModules.nixvim`
- `<nixvim>.nixosModules.nixvim`
- `<nixvim>.nixDarwinModules.nixvim`
`<nixvim>` refers to the way to access nixvim, depending on how you fetched nixvim as described in the previous section.
`<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 = [ <nixvim_import> ]` in a configuration file.
You will then be able to enable nixvim through `programs.nixvim.enable = true`, and configure the
You will then be able to enable Nixvim through `programs.nixvim.enable = true`, and configure the
options as `programs.nixvim.<path>.<to>.<option> = <value>`.
> [!TIP]
> Use `programs.nixvim.imports` to include modules configuring NixVim so you get NixVim's extended `lib` in the `lib` module argument and you don't have to prefix everything with `programs.nixvim`.
> Use `programs.nixvim.imports` to include modules configuring Nixvim so you get Nixvim's extended `lib` in the `lib` module argument and you don't have to prefix everything with `programs.nixvim`.
>
> <!-- This is also in /docs/lib/index.md -->
>
@ -87,29 +87,29 @@ options as `programs.nixvim.<path>.<to>.<option> = <value>`.
> # You can use lib.nixvim in your config
> fooOption = lib.nixvim.mkRaw "print('hello')";
>
> # Configure NixVim without prefixing with `plugins.nixvim`
> # Configure Nixvim without prefixing with `plugins.nixvim`
> plugins.my-plugin.enable = true;
> }
> ```
When you use nixvim as a module, an additional module argument is passed on allowing you to peek through the configuration with `hmConfig`, `nixosConfig`, and `darwinConfig` for Home Manager, NixOS, and nix-darwin respectively.
This is useful if you use nixvim both as part of an environment and standalone.
When you use Nixvim as a module, an additional module argument is passed on allowing you to peek through the configuration with `hmConfig`, `nixosConfig`, and `darwinConfig` for Home Manager, NixOS, and nix-darwin respectively.
This is useful if you use Nixvim both as part of an environment and standalone.
For more platform-specific options and information, see [Nixvim Platforms](../platforms/index.md).
### Standalone usage
When using nixvim as a standalone derivation you can use the following functions, located in `<nixvim>.legacyPackages.${system}`:
When using Nixvim as a standalone derivation you can use the following functions, located in `<nixvim>.legacyPackages.${system}`:
- `makeNixvim`: A simplified version of `makeNixvimWithModule` for when you only need to specify `module` and the other options can be left as the defaults.
This function's only argument is a nixvim module, e.g. `{ extraConfigLua = "print('hi')"; }`
This function's only argument is a Nixvim module, e.g. `{ extraConfigLua = "print('hi')"; }`
- `makeNixvimWithModule`: This function takes an attribute set of the form: `{pkgs, extraSpecialArgs, module}`.
The only required argument is `module`, being a nixvim module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`.
The only required argument is `module`, being a Nixvim module. This gives access to the `imports`, `options`, `config` variables, and using functions like `{config, ...}: { ... }`.
There are also some helper functions in `<nixvim>.lib.${system}` like:
- `check.mkTestDerivationFromNixvimModule`, taking the same arguments as `makeNixvimWithModule` and generates a check derivation.
- `check.mkTestDerivationFromNvim`, taking an attribute set of the form `{name = "<derivation name>"; nvim = <nvim derivation>}`. The `nvim` is the standalone derivation provided by NixVim.
- `check.mkTestDerivationFromNvim`, taking an attribute set of the form `{name = "<derivation name>"; nvim = <nvim derivation>}`. The `nvim` is the standalone derivation provided by Nixvim.
The nixvim derivation can then be used like any other package!
The Nixvim derivation can then be used like any other package!
For an example, see the [nixvim standalone flake template](https://github.com/nix-community/nixvim/blob/main/templates/simple/flake.nix).