The MacOS system upgrades basiclly will uninstall Nix every time and reinstall it again. It will remove the symlink /run/current-system which is the basic environment you are using.
So we need to restore the symlink and activate the nix environment.
-
Find what’s the
/run/current-systempoints to. Actually you may don’t have time to know this before your first run into this trouble, so my method is:- It usually points to one folder listed in
/nix/store/, and with the stringdarwin-systemin the folder name. - We can just use the most recent one as current system. In my case, I only have 1 recent system and others are all at 1970. It is easy to identify.
- It usually points to one folder listed in
-
Link
/run/current-systemto the folder you found. -
Then
cdinto the folder, and run./activateto activate the system.