How can I rescue a broken raspberry pi 4?

I installed nixos of my rpi 4 with sd-image downloaded from hydra, just following the guidance in the wiki. It was working fine for a long time.

I just applied environment.memoryAllocator.provider = "graphene-hardened" to test it out today and run nixos-rebuild switch. It broke everything.
After that It shows a long standard output of error, and I cannot run any command afterwards (with some IOT core dump error).
So I reboot and choose an earlier generation, however it don’t boot up because of some kernal panic.
Then I flashed another USB with the sd-image from hydra and successfully boot up. I then mount the original drive to /mnt and run nixos-enter --root /mnt but it shows an error

System has not beet booted with systemd as init system (PID1). Con't operate.
Failed to connect to bus: Host is down
Activation script snippet 'update-lingering' failed (123)

and change the configuration and delete that line about memory allocator, then run nixos-rebulid switch again. Howewer it show an error about systemd

systemd1 org.freedesktop.systemd1.Manager ListUnitsByPatterns asas 0 0 exited with value 1 at /nix/store/somehash-nixos-system-nixos-rpi4-23.11.20240328.219951b/bin/stwitch-to-configuration line 145.
warning: error(s) occured while switching to the new configuration

What should I do now? Thanks!

Problem solved by doing the above procedure again (offline).