For smaller sized nuts – there was an article in ME (do not have the details to hand) from someone who modelled wooden farm carts and who needed large quantities of small scale (square) nuts in their production.
His solution was to punch them out of brass sheet and then thread them in a small tapping jig. The punch was guided by the tapping sized holes he pre-drilled in rows in the sheet before the punching operation. A relatively small sheet could yield quite a few nuts using this method and would probably be as quick (if not quicker) than machining rod square and then tapping & parting off etc. I've looked at various methods of making small scale nuts for my Gauge '3' railway wagons and this seems to be the most promising approach, although I haven't tried it myself yet.
Another member of the G3 Society also had some brass etches made of various scale-sized Whitworth nuts that were also very good. This could be another possibility where smaller scale nuts are required for cosmetic purposes.
I'm currently using quite a few 14BA nuts in my wagon modelling, which are not quite right scale wise (although they can pass the "6ft away" test) and they are also getting pretty expensive these days…
Regards,
IanT