The President would enter the nuclear launch codes.
The Secretary of Defense would not give his nuclear launch codes.
The nuclear bombs would not be launched.
The Secretary of Defense would appeal to the Vice President who, with support of Congress under the 25th Ammendment Section 4 of the constitution would remove the President.
The Vice President would become the new President.
Mainstream News Agencies would get lots of content for the next 2 months.
The world would go back to normal.
A few people have expressed concerns that the present chain of command is vulnerable to an unscrupulous Secretary of Defense. To address these concerns one has to delve further into the specifics of American Constitution and law.
According to Article 92 of the Uniform Code of Military Justice–
“Any person subject to this chapter who violates or fails to obey any lawful general order or regulation;…shall be punished as a court-martial may direct.”
Note the key word lawful. This has been interpreted to mean that any unlawful order does not necessarily need to be obeyed within the military.
In fact, obeying an unlawful order can be punishable.
Hence, if there is no imminent threat recognized, the chain of command after the Secretary of Defense has the authority to disobey any decision made by the President (and the Secretary of Defense). This means that the Joint Chiefs of Staff and the Unified Combatant Commanders would be able to disregard the decision of the President. Since the President saying “F*** it, let’s blow up a country” is an unlawful command and since the chain of command after the Secretary of Defense is more than capable of recognizing it, nuclear weapons would not be launched.
After this, obviously both the President and the Secretary of Defense would be tried by both the chambers of Congress, the US Senate and House of Representatives and will be relieved of their duties. Of course, one might argue that since the US Congress is largely Republican, a bias decision could be taken.
Hence, after this under Section 3 of the 25th Amendment the President may issue a written declaration to Speaker of the House of Representatives (currently Paul Ryan) stating that the President is unable to discharge the powers and duties of his office, and until he transmits to them a written declaration to the contrary, such powers and duties shall be discharged by the Vice President as Acting President.
Now, of course you may say that since Paul Ryan is Republican, he will take a biased decision but there are further protocols preventing the same.