Bootloader persists generations based on old kernel

Hey all, I enabled automatic kernel updates in my system configuration.nix on Nixos awhile back by following the wiki. Some weird behavior has occurred since and I’m not sure how to resolve it. After enabling the latest kernel package I ran the commands in the wiki and surely enough I’m on 6.2 version of the kernel and when I boot into my machine I am greeted with the proper zsh shell environment. The weird behavior occurs is that at some point in the day, nix in the background will switch me back to the default generation and kernel version that shipped with the nixos iso. And the bootloader sets this generation and kernel version as the default one. Not really sure how nixos decides to nixos-rebuild switch itself in the background. It causes a few problems, easily mitigated for the most part, like my home-manager managed user gets locked out because it loses track of the user and password so I have to reboot and boot into the correct generation which is now one generation behind and it resets the machine hostname.

Things I’ve tried, is really just aggressively pruning old generations with nix-collect-garbage which helps a bit but as I mentioned earlier if I leave my machine idle for a day it will create and switch to the old default generation. I have also tried to just ensure to just rebuild my config at least once a day so its always the latest generation.

Do you have any systemd timers that run a nixos-rebuild or such? You can check with systemctl list-timers.

Thanks for the reply, no I have not configured any systemd timers

Exact same problem here. Also, have not found any workaround except for rebuilding manually.