With NixOS, I’ve gotten used to checking in my entire system config to git.
Well, except it’s not the entire config, since I rely on Nix channels and system.autoUpgrade to automatically get security updates and the like.
All of that makes sense to me and doesn’t feel especially ugly.
Now that I’ve begun adopting flakes for some of my packages, I have gotten used to including everything in git, including the locked version of Nixpkgs. But I still want automatic updates of my machines!
Naively, I can imagine setting up CI somewhere to do a bunch of flake lock updates and auto-commits, but that all seems ugly. I assume there is a best practice for autoUpgrades of flake-based NixOS systems that avoids all that?
That’s just because you (and hopefully nobody else) don’t look too closely at the security issues found in all packages on your system - which in turn is a good reason for auto updates, because then you don’t need to look too closely to stay safe.
Personally I don’t like automated updates, I prefer having some control, so I have a weekly CI job that also runs some basic tests whose commits I manually apply when convenient. It fails often enough due to upstream changes (nvidia…) that I think this is justified, too.
If a serious vulnerability pops up - I am sure that I’ll hear about it, and for minor vulnerabilities, it’s not worth risking my system stability. Especially since its not exposed anywhere
While issues after upgrade are rare, they do exist
Some people choose one way or the other on the trade-off of automatic updates. My question was how to do them with flakes. Thanks for the answers so far. Feel free to add other workflows if you have them.
Yeah I was specifically asking for that. But perhaps it doesn’t even matter too much, eg it wouldn’t restart services that haven’t change afaict. Perhaps daily will be enough though.
It would, assuming those services don’t have the don’t-restart-on-update attribute set. There are some services you wouldn’t want to insta-update (login managers come to mind), and those have specific exceptions (which can be overridden if you are so inclined). I don’t think kexec for updating to a new kernel version is supported by NixOS yet either.
You can set the reboot settings, which will reboot the system during a specific window if there were updates.
But indeed, I think doing it more frequently than daily is a bit overzealous. I doubt nixpkgs will update most things at that frequency, so you’re not gaining much.