i just need something like
nixos-rebuild switch; sleep 5; if [ ! -f /tmp/done\_switching ]; then nixos-rebuild switch --rollback; fi;