2024-04-20 05:57:11 +02:00
|
|
|
# NixOS Module {#ch-nixos-module}
|
|
|
|
|
2024-04-27 14:44:37 +02:00
|
|
|
The NixOS module allows us to customize the different `vim` options from inside
|
|
|
|
the NixOS configuration without having to call for the wrapper yourself. It is
|
|
|
|
the recommended way to use **nvf** alongside the home-manager module depending
|
|
|
|
on your needs.
|
|
|
|
|
|
|
|
To use it, we first add the input flake.
|
|
|
|
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
inputs = {
|
2025-01-07 02:19:57 +01:00
|
|
|
# Optional, if you intend to follow nvf's obsidian-nvim input
|
|
|
|
# you must also add it as a flake input.
|
2024-04-27 14:44:37 +02:00
|
|
|
obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
|
2025-01-07 02:19:57 +01:00
|
|
|
|
|
|
|
# Required, nvf works best and only directly supports flakes
|
2024-04-27 14:44:37 +02:00
|
|
|
nvf = {
|
|
|
|
url = "github:notashelf/nvf";
|
2025-01-07 02:19:57 +01:00
|
|
|
# You can override the input nixpkgs to follow your system's
|
|
|
|
# instance of nixpkgs. This is safe to do as nvf does not depend
|
|
|
|
# on a binary cache.
|
2024-04-27 14:44:37 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2025-01-07 02:19:57 +01:00
|
|
|
# Optionally, you can also override individual plugins
|
2024-04-27 14:44:37 +02:00
|
|
|
# for example:
|
|
|
|
inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Followed by importing the NixOS module somewhere in your configuration.
|
|
|
|
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
# assuming nvf is in your inputs and inputs is in the argset
|
|
|
|
# see example below
|
|
|
|
imports = [ inputs.nvf.nixosModules.default ];
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-04-27 15:04:09 +02:00
|
|
|
## Example Installation {#sec-example-installation-nixos}
|
2024-04-27 14:44:37 +02:00
|
|
|
|
|
|
|
```nix
|
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
nvf.url = "github:notashelf/nvf";
|
|
|
|
};
|
|
|
|
|
2025-01-04 13:35:55 +01:00
|
|
|
outputs = { nixpkgs, nvf, ... }: {
|
2024-04-27 14:44:37 +02:00
|
|
|
# ↓ this is your host output in the flake schema
|
2025-01-04 13:35:55 +01:00
|
|
|
nixosConfigurations."your-hostname" = nixpkgs.lib.nixosSystem {
|
2024-04-27 14:44:37 +02:00
|
|
|
modules = [
|
|
|
|
nvf.nixosModules.default # <- this imports the NixOS module that provides the options
|
2025-01-04 13:35:55 +01:00
|
|
|
./configuration.nix # <- your host entrypoint, `programs.nvf.*` may be defined here
|
2024-04-27 14:44:37 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Once the module is properly imported by your host, you will be able to use the
|
|
|
|
`programs.nvf` module option anywhere in your configuration in order to
|
|
|
|
configure **nvf**.
|
|
|
|
|
|
|
|
```nix{
|
|
|
|
programs.nvf = {
|
|
|
|
enable = true;
|
|
|
|
# your settings need to go into the settings attribute set
|
|
|
|
# most settings are documented in the appendix
|
|
|
|
settings = {
|
|
|
|
vim.viAlias = false;
|
|
|
|
vim.vimAlias = true;
|
|
|
|
vim.lsp = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
::: {.note}
|
2024-11-07 13:45:03 +01:00
|
|
|
|
2024-04-27 14:44:37 +02:00
|
|
|
**nvf** exposes a lot of options, most of which are not referenced in the
|
2024-11-07 13:45:03 +01:00
|
|
|
installation sections of the manual. You may find all available options in the
|
|
|
|
[appendix](https://notashelf.github.io/nvf/options)
|
|
|
|
|
2024-04-27 14:44:37 +02:00
|
|
|
:::
|