One thing the movie “Armeggedon” got right, is that to destroy a comet or asteroid with a nuclear bomb, you will have to LAND on it, DRILL a hole into the center of the mass, and insert your bomb. Setting a nuke off on the surface of the body, will do little to nothing. (N.B. No atmosphere, no shockwave.) Hitting the body with something fast and heavy, in the right spot, would be the best way to deflect anything.
A better way to dispose of any such troublesome rocks, would be to fly out there, and attach something like the Space Shuttle’s Solid Rocket Boosters. Probably would need a few smaller steering rockets, as well. Then set a course and fly the thing into the Sun, and permanently eliminate it.