This repository contains a reproducible Neovim configuration built using nixCats-nvim and lazy.nvim. It is designed to be consumed as a Flake input by a NixOS system, but can also be tested and built locally.
When adding plugins or changing configurations, follow this strict order of operations to ensure Nix picks up your changes.
- Add Dependencies: Modify
nvim/flake.nixif you need to add new plugins or external tools to the flake inputs. - Configure Neovim: Modify
nvim/lua/plugins/your-plugin.luaor other configuration files to set up the plugin.
Nix Flakes only see files that are tracked by git. If you do not stage your new files or changes, Nix will ignore them.
cd nvim
git add .Before updating your entire system, verify that the configuration loads correctly.
# Run Neovim directly from the flake source
nix run .
If this works, your configuration is valid.
Once you have verified the config via nix run ., you need to update your main NixOS configuration to use the new commit/hash of this repo.
- Commit and push your changes in this Neovim repository.
- If your NixOS configuration tracks a branch (e.g.,
main), it will pick up the changes automatically on the next generic update.
If you have staged changes (via git add .) but haven't committed them yet, or if you are pointing to a local path:
- Update the flake lock: Tell your system flake to update specifically the
nvim-configinput.
# Replace 'nvim-config' with whatever you named this input in /etc/nixos/flake.nix
sudo nix flake update nvim-config --flake /etc/nixos
- Rebuild the System:
sudo nixos-rebuild switch
To check if the derivation builds successfully without running it:
nix build .
# The output will be linked to ./result
When you need to update the inputs defined inside the Neovim flake (e.g., bumping plugin versions):
cd nvim
nix flake updateSince we are using Nix, sometimes lazy.nvim state or cache can desync or become cluttered. To reset the state and download fresh copies of plugins (that aren't managed strictly by Nix):
rm -rf ~/.local/share/nvim/lazy ~/.local/state/nvim ~/.cache/nvim
- Workflow Logic: It emphasizes the "Edit -> Git Add -> Update Flake -> Rebuild" loop.
- Safety: It highlights the importance of
git add .(a common pitfall). - Testing: It provides the
nix run .command for fast feedback. - Maintenance: It includes the specific cleanup commands for
lazy.nvimpaths.
-
Modifichi
nvim/flake.nix(aggiungi un plugin) -
Modifichi
nvim/lua/plugins/qualcosa.lua(lo configuri) -
Fondamentale: Vai nella cartella nvim e fai
git add . -
Spostati nella cartella NixOS principale
-
Update del flake principale:
- O si fa il commit della repo e nix lo riconosce automaticamente al prossimo rebuild
- O si fa l'update manuale dopo una modifica staged (
git add .)sudo nix flake update nvim-config --flake /etc/nixos
-
Ricompila il sistema
sudo nixos-rebuild switch -
Per verificare velocemene se le impostazioni di nvim sono a posto usare nella cartella .config/nvim:
nix run .e vedere se va (dopo aver fattogit add .) -
Per eliminare i plugin scaricati da lazy:
rm -rf ~/.local/share/nvim/lazy ~/.local/state/nvim ~/.cache/nvim -
Quando si aggiunge un input al flake della config:
nix flake updatenella dir di config nvim -
per testare nvim:
nix run .oppure compilarlo inresult/connix build .