The need to be in the sun isn't about power. Wherever JWST is, it
has to be exposed to either the sun or to a planetary body that's shielding it.
At the low temperatures involved, Earth's night side puts out enough infrared radiation from its own heat to cause problems. JWST is all the way out at Sun-Earth L2 not for power reasons, but so that it will never be in a position where it needs to keep off heat from two different directions.
Nuclear does not help with this. In fact, by having a nearby penetrating radiation source and a high-temperature core mechanically connected to the spacecraft, it may be worse from a thermal perspective.
JWST is a strange spacecraft with very strange design constraints. Your intuitions about planetary/Earth-science or higher-frequency astronomy will not serve you well here.