You want proportionality in defense. If someone sends in 12 soldiers in a border raid, are you going to murder 5 million people in retaliation?
Are you even sure that the perpetrators were sponsored by the country you are nuking ?
Also, you need to be able to defend against pirates for open seas... nukes don't help there.
There are infinite scenarios where nukes aren't the answer.