In the aftermath of WWII the United Nations was formed as a noble attempt at a planetary democracy, which aspired to nothing less than eliminating the "scourge of war" through international due process. The Charter is the UN's Constitution, and its Preamble declares one of its official purposes to be "...to reaffirm faith...in the equal rights...of nations large and small...".
If we're going to accept these words at face value, any attempt to prevent countries from arming themselves with nuclear weapons is blatantly hypocritical. In fact, the Charter's Article 51 extends the idea:
Nothing in the present Charter shall impair the inherent right of individual or collective self-defense if an armed attack occurs against a Member of the United Nations...
In the document it's not explicitly clear what methods of self-defense are available. Though the concept of proportional response is not mentioned, the world community might accept precedents such as the
Caroline Affair of 1837 in support of it. And certainly common sense would dictate that if Iran is attacked with nuclear weapons, they have the right to respond in kind. Yet the United States and other nations have already made clear that any attempt by Iran to get the bomb could be met with force - in violation of another Preamble dictate to "practice tolerance and live together in peace with one another as good neighbors".
So maybe the Charter should be amended to include a right to bear arms, an international Second Amendment, which would guarantee all nations the same defense rights which nine nations already lay claim to. The United States would benefit greatly by the export of nuclear technology - in a practical sense, it would create jobs and revenue. And though it may result in every nation being armed with nukes, it's possible that the mere uncertainty of whether a nation has gone nuclear would act as a deterrent to the use of force. We couldn't be sure which nations were "carrying".
Then we'll all be safe.