US military members are required to obey lawful orders and to refuse to obey unlawful ones. that much at least is clear from the UCMJ, oaths of office and enlistment, etc.
Examples of an unlawful order at a low level are to execute those thieves or burn that village and kill all the inhabitants.
Under both US law and the various treaties forming “the laws of war” wanton destruction without provocation or military benefit is illegal.
The expectation and the practical reality is not that military members will be carefully evaluating the legalistic edge cases or consulting their attorneys before firing. But rather that they have an obligation to not commit flagrant unmistakable violations while claiming “I was just following orders” or even “I didn’t stop to think, I just did.” Nope. You have an affirmative duty to think before you commit violence. Every time.
With all that background …
The President, any President, deciding to nuke, say, CNN HQ clearly and obviously fails that test. Getting away from nukes for a moment, the Posse Comitatis Act prohibits the deployment of Federal troops in the US for lots of purposes. The Constitution itself prohibits quartering troops in private homes. Any presidential order to do those things fails the test.
Going back to nukes, the US pre-emptively attacking some nation without major provocation or very clear warning of hostile intent comes real close and may be over the line. etc.
Where the generals will really earn their pay is the hypothetical murkier cases where cooler presidential heads might wait, but hostilities are unequivocally in progress.
The US has an uncomfortable relationship with the law of war as it relates to destroying civilian populations from the air or space. It’s not per se illegal, but neither is it clearly legal. How much of a nexus to targets of immediate military value or eventual military utility are required before blowing up a city containing a military base, a munitions factory, or a truck factory?
It’s pretty clear that in any hostilities with a minor power we have the raw numbers to counterattack dreadfully disproportionately. Again, how much is too much where a legal counterattack turns into an illegal reprisal attack?
The only things nukes add to the mix is the hair trigger immediacy and potential scale of the response. Which hair trigger made deterrent sense during the Cold war and may still make deterrent sense. But which may also be able to be achieved more smartly than with the President + “football” = Doomsday system dating from the Eisenhower era.