It is up to Ukraine, but I think a few points remain extremely important:
Any gain that Russia can retain from its aggression vindicates their invasion. And they will do it again. To the Russian government, personnel losses are irrelvant.
Any peace that does not include Ukraine in a strong alliance (read: full NATO membership) will allow Russia to rebuild military strength and attack again to finish what they started
Any deal that Russia signs is not worth the paper, as we have seen with the wanton violation of the Budapest Memorandum, in which Russia agrees to respect the borders of Ukraine as defined in the Helsinki Accords, and not to use force or threat of force against any signatory state (which included Ukraine).
From which follows: only a strong Ukraine, backed by credible assurances of defense by all of NATO will keep Russia from attacking again. Not a written deal alone.
It is up to Ukraine, but I think a few points remain extremely important: