I would not hold high hopes on nukes being any good or effective about nanoscale machinery, despite Starfish providing good enough answer as general assumptions.
The reason for that is a possible multitude of deployment tactics. Even with your chosen one "swarm of locusts, like a black cloud of death" there is plenty of options.
Best countermeasures are similar machines, and if another side does not have one - they pretty much are toast.
as a model to think about, a modeling example which may have similar properties as named nanomachines and on the topic of the effectiveness of nukes in the case - it possible to take viral infections(which not exactly visible, but still effective enough) or microorganisms which exists in soil, or general dust present in atmosphere.
To get visible effects of the presence - the nanomachines may be indeed like dust particles - dust like a shell for few nanomachines which they are using as a carrier(like those or similar to particles which are suggested to counter global warming in some studies - those flying high for a long time, and with changing properties introduced by nanite structures in them they can fly as they wish). Then the most of the mass of the stuff will be quite robust and inert material - thus it pointless to imagine them being easily vulnerable by UV, EMP, certain levels of radiation, light burns or air pressure.
They can clump in something bigger - like mosquito size and indeed fly as a cloud of insects instead being delivered by missile or airplane or crawl underground or other less detectable ways of deploying them.
But even with mosquito size carriers - which they may collect for the means of keeping communications with base or other necessities - they probably do not have to be a super-dense cloud of the stuff and even if they have for some reason to gather in a visible cloud it not likely to be one super big but many small ones on a distance from each other - so it can be spread of many smaller clouds - which will make certain average density of the machinery in the area which does not have to be high - thus making nukes not so effective as it would be against buildings and humans.
Dust particles of 10um size, in a concentration of around 10mg per cubic meter, are enough to form visibility problems like that
And if we take 2Mt airburst from nuke map, we can hope for 2.3 km radius cleanup(most likely, but not fully) to 10.3 km radius cleanup(less likely, not fully)
2.3km radius is:
500 rem radiation dose; without medical treatment, there can be
expected between 50% and 90% mortality from acute effects alone.
So it is not an immediate hell of fire cleanup, it just some percentage of cells in a big body are destroyed enough to malfunction - but it does not mean all of them are destroyed - soo the same for the nanomachines - it won't be 100% cleanup of a territory.
50m height and that smog density of 10mg/m3, and 2.3 radus (4.6km diameter) of those nanites loss will be about 8 ton of them being destroyed(if we assume 100% destruction at 500 rem level). Considering you have developed a nanotech situation(with those buildings and such) it does not seem like it will be big loss for the stuff.
In general, having a developed nanotech situation, if the other side does not deploy countermeasures of similar nature - it stands no chances. And nuke deployment agony won't help them that much.
Countermeasures of a similar nature do not mean a battle of clouds - it can be up to level individual nanohazard suits - which form some penetration barrier. If those are dummer version nanites - then suitable antibodies or something. Or a shell of nanites of a different kind that consumes attacking dust nanites as fast as they land on the skin/cloth. etc.
Using nukes as countermeasures won't be effective and more so it will be more self-destructive. And if you have to use nukes - best you can do is to target those who are benefiting and controlling that nanite deployment.
Considering developed nanotech situation you have - building buildings I consider a sign of mature and abundant nanotech which then probably is used everywhere(most likely) replacing at least 90% of our todays doing with that assistance - and then it pretty much all-powerful situation to control any live organisms which do not have proper countermeasures.(maybe soil bacteria may be exempt - but only for reason there are too many of them, too deep and they mine their own business and not worth attention that much. require to spend too much energy for too little gain)
you may reconsider the nature of nanites, instead of imagining them like some nano fog and abstract small things, you may try to model them, imagine them as like 1-2um thick wires(which internally consist of 1000's if smaller wires, that internal structure makes it possible to actuate and do some magic. I call it smart matter, and there are few articles about it) of 0.1-1-100cm length's(different sizes). wires which can act like worms or snakes of their size, so as fiber like wool, glass fiber etc with capabilities to form ropes, fabric, beams, whatever you may imagine carbon fiber or fiberglass to be used for etc etc.
It may make it easier for you to imagine the properties of objects made of those 2d nanites, and it is a possible direction of nanotech development(lookup for "artificial muscles"), in some sense maybe even more practical, with plenty of utilitarian use. And it can be easier mapped to the objects and stuff we have today, with additional properties which come from the flexibility of arrangement of those microwires.
It may help to imagine more interesting deployment tactics and countermeasures tactics or helplessness in the absence of those countermeasures. There are endless ways to spin stuff in those circumstances - any flying apparatus (airplane, blimp, missile) reaching the area of deployment and then disappearing in dust cloud falling on the area. Small worm-like stuff digging sub mm tunnels network under area 2-3-5km deep underground and bursting out covering everything with them in a matter of minutes when the time comes. Disguise as usual live organisms wandering around and blasting on command in small particles to glue to anything you may target etc etc.
So as it is easy to tune the situation, when both sides have the nanotech, to any outcome as it is typical "shield vs sword" situation