My thoughts are:
the whole point of having a nuclear aresenal is to scare the potentional enemies. The enemy has to know, that in case they'd attack me with nuclear (or other) weapons, I'd retaliate with the same or stronger force.
But how does this "eye for an eye" (I don't say MAD, because it's not quite the case here) principle fits into the 21st centure, where the principal enemies are not states, but non-state actors which are sometimes being supported by states or some state institutions?
If the random country gave its nuke to the terrorists, or gave them the means to build one themselves, would that constitute an attack? Would it mean it indirectly attacked the target country? And if it was so, would that mean than nuclear retaliation is justified?
I am afraid that terrorists are just another form of "warhead delivery system". In my opinion, it doesn't make any difference if someone launches a nuclear missile at you or smuggle the nuke into your country and then detonates it.