I want to check daily for new versions of flake, but upgrade them the next time I do nixos-rebuild. I did some looking up and didn’t find anything in particular. I could use systemd to run nix flake update daily.
system.autoUpgrade includes flake options.
Edit: sorry, realized you actually asked about updating the flake and not the system. I run [this service] (nixos/hosts/office/services/nixos.nix at 38e6b7b410fe6fb3ecb8bada64a2efc88b3e6669 · firecat53/nixos · GitHub) on my desktop to update flake.lock. That gets propagated to the other machines with Syncthing. I know a lot of people keep flake.lock in version control, but I’ve found it works better for my use case to not track that since I don’t have hard requirements for pinning exact versions.
How could I use system.autoUpgrade to auto update the lock file though?
That’s why I edited my comment to show a flake-update service. It’s two separate operations.
Could I do both, autoupgrade and update it?
You have to update the lock file first and then upgrade. That’s just the way flakes work. Notice in the service for nixos-upgrade.service that it is required to run after the flake-update service.