>>1580118current commercial technology is "About the size of two school buses stacked end to end"
https://www.wired.com/story/the-next-nuclear-plants-will-be-small-svelte-and-safer/This design produces 60MW, which is probably enough to move a train.
military reactors which fit into submarines are likely about the same size, but due to their higher enrichment (90+% compared to civilian restrictions to about 7%) will output far more energy.
I'd expect a nuclear-powered train to be quite possible, though the reactor and ancillary equipment would take up four or five carriages. The bigger question is "is it worth the effort in comparison to other methods," such as electric locomotives powered by fixed reactors. The answer is "probably not"