diff --git a/pkgs/darwin-uninstaller/default.nix b/pkgs/darwin-uninstaller/default.nix index 3eb2c244..a82974e7 100644 --- a/pkgs/darwin-uninstaller/default.nix +++ b/pkgs/darwin-uninstaller/default.nix @@ -63,10 +63,21 @@ stdenv.mkDerivation { ${uninstallSystem.system}/sw/bin/darwin-rebuild activate - if test -L /run/current-system; then + if [[ -L /run/current-system ]]; then sudo rm /run/current-system fi + if [[ -L /run ]]; then + if [[ -e /etc/synthetic.conf ]]; then + sudo sed -i -E '/^run[[:space:]]/d' /etc/synthetic.conf + sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B &>/dev/null || true + sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t &>/dev/null || true + echo >&2 "NOTE: the /run symlink will be removed on reboot" + else + sudo rm /run + fi + fi + echo >&2 echo >&2 "NOTE: The /nix/var/nix/profiles/system* profiles still exist and won't be garbage collected." echo >&2