Best practices for auto-upgrades of flake-enabled NixOS systems?

If someone runs the config snippet by @sinnlos23 but gets an error like

[...]/nixos-rebuild: line 174: /nix/store/zlws4p5azdj27g1nmri6k1c53bzv0psc-source/bin/nixos-rebuild: No such file or directory

there is a fix here: system.autoUpgrade failed to run.

Essentially, replace the flake source by "path:${rootPath}", which magically resolved this issue. Took me a while to find, so I am adding it here.

7 Likes