nvim-utils
is a collection of utility functions and modules for managing
Neovim configurations / plugins in Nix. It aims to simplify the creation of
reproducible, reusable, and extensible configurations.
You can get up and running with your own configuration by calling mkNvimPkg
.
# flake.nix
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nvim-utils.url = "github:/toalaah/nvim-utils";
inputs.nvim-utils.inputs.nixpkgs.follows = "nixpkgs";
outputs = {
self,
nixpkgs,
nvim-utils,
}: let
system = "x86_64-linux";
in {
packages.${system}.default = with nvim-utils.lib;
mkNvimPkg {
pkgs = import nixpkgs {inherit system;};
modules = [baseModules.all];
configuration = import ./configuration.nix;
};
};
}
Configuration for nvim-utils
is simply a module, as you may be used to from
NixOS or Home Manager.
# configuration.nix
{
treesitter.enable = true;
treesitter.opts.highlight.enable = true;
lsp.lspconfig.enable = true;
# enable lsp tooling for lua and nix
languages.lua.enable = true;
languages.nix.enable = true;
# plugin opts are directly converted to their lua representation!
telescope.enable = true;
telescope.opts.pickers.find_files = {
theme = "dropdown";
};
}
Detailed usage documentation and available module options can be found here.
How do I define (keybindings/autocmds/...)?
See the documentation. If something you need is not supported, open an issue.
How is this different to NixVim?
It's not really that much different to be honest aside from the fact that
nvim-utils
is significantly less mature, feature-rich, and more bug-prone. I
suppose the primary difference is the plugin backend used (or lack thereof),
as nixvim
seems use packer / packadd
rather than lazy
(although there
appear to be discussions surrounding this). So why reinvent the wheel?
- TBH I was not aware of this project until well into development of this tool
- One of the goals with this project
wasis to improve my understanding of the Nix language - I wanted to continue using
lazy.nvim
as my plugin manager while moving to a more nix-based neovim configuration
Plugin <...> is not available
You can quite easily integrate any plugin of your choosing to nvim-utils
. See
the relevant
section
in the documentation
- lazy.nvim, used as the plugin backend.
- home manager, for general guidance on custom module structuring and auto-generation of documentation.
- nix-vim, a similar approach to nix-based neovim configuration
This project is released under the terms of the GPL-3.0 license.