Moved installation to new drive, now user profile resets daily - what did I do wrong?

Hi All,

I was running out of disk space so got a new drive. I’m using a flake for my system configuration and home-manager as a NixOs module.

My possibly naive approach to try to replicate the system as quickly as possible on the new disk:

  • Fresh install of NixOs on new drive
  • Copy /home and most of /var from old drive (keeping permissions)
  • Copy my NixOs flake config over, but use new hardware-configuration to get new disk uuids
  • nixos-rebuild switch --flake etc on new drive. Home manager complained about some files being in the way but once those were removed it switched fine.

All seems to work great and the system is just as before, however I have a strange issue:

Every morning when I boot, a few seconds after booting, my user profile reverts to some default version of the profile with all user packages missing. For about ten seconds it’s fine, and then it reverts, and it happens whether I’ve logged in or not. I have to rebuild switch again to get it back. The strange part is if I hard-reboot again on the same day it stays on the correct profile until the next morning, and then it does it again.

I’m guessing there’s something I either shouldn’t have copied over, or something I missed copying over.

Any ideas how to resolve it, or maybe a better way to migrate quickly to a new disk?