A minimal starter template for LazyVim on Nix with Home Manager using Lua, based on the lazy.nvim on NixOS guide by KFerasoff.
The template uses Nix to manage Neovim as a software packages and its plugins. But it uses Lua for configuration of Neovim and the plugins themselves. All the LazyVim plugins are disabled, so that you can start from a (somewhat) clean sheet and decide for yourself which plugins you want to enable. Nevertheless, all the LazyVim default autocmds, keymaps and options are still enabled, which might easily lead to errors. So you might want to disable unused autocmds/keymaps/options that rely on not installed plugins!
Please check KFerasoff's guide for more details about the general setup.
As mentioned, we manage the installation of Neovim and its plugins with Nix. Let's add and configure a custom colorscheme, e.g. Modus Themes.
- Add plugin to
programs.neovim.pluginsindefault.nix(e.g.modus-themes-nvim) - Configure plugin in
./lua/pluginsdirectory (e.g.lazyvim.lua) - Rebuild your configuration
Same procedure as mentioned above:
- Add plugin to
programs.neovim.pluginsindefault.nix(e.g.which-key) - Optional: configure plugin in
./lua/pluginsdirectory (e.g.which-key.lua) - Rebuild your configuration
To enable LazyVim Extras, you simply follow the above pattern with a small change:
- Add plugin to
programs.neovim.pluginsindefault.nix(e.g.mini-surround) - Import plugin configuration in
default.nix, in the lazy setup section of theextraLuaConfigpart:{ import = "lazyvim.plugins.extras.coding.mini-surround" } - Optional: configure plugin in
./lua/pluginsdirectory (e.g.mini-surround.lua) - Rebuild your configuration