The story
The analogy dates back to at least the middle of the 19th century: see, for example, this quotation from Levi Carroll Judson’s work Sages and Heroes of the American Revolution (1851): “He at once became the nucleus around which a band of patriots gathered and formed a nut too hard to be cracked by the sledgehammer of monarchy.”
Etymology from Wiktionary, CC BY-SA 4.0.