How much of nukes is even hardware vs software? I'd naively think that you'd probably just rip out the core of the device and wire up a new thing that can zap it to go boom.
Nuclear bombs are strongly disinclined to "go boom" unlike say TNT. Turning the energy from splitting atoms into a large explosion, which is what you want from a weapon, will require precise timing. If you get it wrong either nothing happens, or you maybe create a small detonation, and cover a modestly sized area with dangerous debris from the failed attempt. Just throw a box of grenades into a waste water treatment plant or something instead for a fraction of the cost.
For reference, there have been a number (dozens, at least) of nuclear devices dropped accidentally all over the world (some of which landed in the USA), but none have ever accidentally detonated.
This was a plot device in the popular Fallout games. Where a city had built up around a nuclear bomb which failed to detonate during a nuclear war.
The timing of the explosives around the core is extremely important to actually getting a nuclear detonation instead of just a dirty bomb so the precise timing and triggering of the detonators is a very critical part of the bomb. They're not just simple fuses you can light and run away.
Then use rad-hard arduino/esp-32/cortex-m0/RittzkenfaiiV/whatever equivalents running NTP / Precision Time Protocol(PTP) in a cluster, with the elements embedded in the individual explosives. Maybe read about https://duckduckgo.com/?q=+fourth+generation+nuclear+weapons and how that could be applied to the material at hand, Ka-Boom!
You can, but it's not as simple as it sounds. Since the timing of the explosives is critical to achieving a nuclear explosion, you can't really do the timing all in software. You need a specialized network of switches that splits the detonation signal several times so that all the explosives go off at exactly the same time. Even the wires have to be cut to the same length with a tiny margin of error.
You can replace the timing and electronics mechanism prior to that network, but probably any sort of tamper resistant mechanism for a weapon will remove part of that network of switches if removed from the device. The rest of the controls are just too easy to replace to be effective at keeping someone from a roll your own type solution.
I think about nuclear physics and high performance aerospace as the distinction between hardware and software shrinking to zero.
You're effecting physical operations (movement, explosions) on such tight timescales that the software becomes part of the hardware. You can't just run the code on a different setup: the code is defined by the hardware it's running on, because it's orchestrating the physical properties of the hardware it's running on.
As an analogy, think about programming early video game systems or computers, where a single clock cycle was critical. Is the software just software? Or is it intertwined with the hardware it's running on? (See: emulators having to mimic actual hardware performance)