2023-06-06 00:01:44 +00:00
|
|
|
[[ch-hm-module]]
|
|
|
|
== Home Manager
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
The Home Manager module allows us to customize the different `vim` options from inside the home-manager configuration
|
|
|
|
and it is the preferred way of configuring neovim-flake, both on NixOS and non-NixOS systems.
|
|
|
|
|
|
|
|
To use it, we first add the input flake.
|
2023-06-06 00:01:44 +00:00
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
neovim-flake = {
|
|
|
|
url = github:notashelf/neovim-flake;
|
|
|
|
# you can override input nixpkgs
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-10-03 19:06:26 +00:00
|
|
|
# you can also override individual plugins
|
|
|
|
# i.e inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- obsidian nvim needs to be in your inputs
|
2023-06-06 00:01:44 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
Followed by importing the home-manager module somewhere in your configuration.
|
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
# assuming neovim-flake is in your inputs and inputs is in the argset
|
|
|
|
imports = [ inputs.neovim-flake.homeManagerModules.default ];
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
An example installation for standalone home-manager would look like this:
|
2023-06-06 00:01:44 +00:00
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
2023-10-03 19:06:26 +00:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
home-manager.url = "github:nix-community/home-manager";
|
|
|
|
stylix.url = "github:notashelf/neovim-flake";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { nixpkgs, home-manager, neovim-flake ... }: let
|
|
|
|
system = "x86_64-linux"; in {
|
|
|
|
# ↓ this is the home-manager output in the flake schema
|
|
|
|
homeConfigurations."yourUsername»" = home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
|
|
modules = [
|
|
|
|
neovim-flake.homeManagerModules.default # <- this imports the home-manager module that provides the options
|
|
|
|
./home.nix # your home-manager configuration, probably where you will want to add programs.neovim-flake options
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2023-06-06 00:01:44 +00:00
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
Once the module is imported, we will be able to define the following options (and much more) from inside the
|
|
|
|
home-manager configuration.
|
2023-06-06 00:01:44 +00:00
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
programs.neovim-flake = {
|
|
|
|
|
|
|
|
enable = true;
|
2023-10-03 19:06:26 +00:00
|
|
|
# your settings need to go into the settings attribute set
|
|
|
|
# most settings are documented in the appendix
|
2023-06-06 00:01:44 +00:00
|
|
|
settings = {
|
|
|
|
vim.viAlias = false;
|
|
|
|
vim.vimAlias = true;
|
|
|
|
vim.lsp = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
[NOTE]
|
|
|
|
====
|
|
|
|
You may find all avaliable options in the https://notashelf.github.io/neovim-flake/options[appendix]
|
|
|
|
====
|
|
|
|
|
|
|
|
|
2023-06-06 00:01:44 +00:00
|
|
|
|