I am happy to now be completely managing my NixOS configuration using Flakes. I
branch from master;
run nix flakes update;
commit the lock file on the branch;
run nixos-rebuild boot --flake .;
then reboot;
make sure I’m happy;
then merge the branch to master;
git push; and
delete the branch.
I have a clean history in master and can always rebuild my system. It’s great.
I’m missing good visibility though on what changes during each flake update. How can I compare two NixOS flake definitions versions in git and get a report on what software has been added, removed or upgraded? It would be helpful to know what’s changing between reboots and it would really help with diagnosing problems.
Unless you want to, the branching and committing is not necessary. Nix only needs a file to be tracked by version control. Even if there are unstaged changes on it as long as the file itself is tracked, Nix will detect the changes and build accordingly. You can then stage and/or commit at your leisure.
As for the diff, I agree. Guix gives a nice apt-style report on changes between two versions. Nix just prints hashes and days. Would be nice to see if something like that can happen, but UX will need to be thought about. There are yuuge amount of changes between any two unstable updates alone.
Thanks @hqurve. I didn’t know about nvd and knowing about nix eval ".#packages.${system}.homeConfigurations.$USER@$hostname.activationPackage" --raw is extremely useful too. I might try and write a script to place the nvd output into the git commit. I can post on here again in the future if anybody is interested in this.