@nprofile1q... what I usually do is have an external binary cache and make the custom upgrade script upgrade only if the 'nixosCpnfogurations.$host.config.system.build.toplevel.outPath' is in the binary cache. The binary cache is populated only when everything in the CI passes. That way, the edge devices never have a bad update.