There are many different ways to make nanites. Refining Runaway Mould is one option favoured by many players. However this is often inconvenient in Hardcore mode, where it is time consuming to refine mould due to the reduced stack size.

Here is a short guide to making a large amount of nanites, assuming that money is not an issue (it may cost several million units).

Step 1.
Fly to a Pirate space station. This guide works best if you have already visited the space stations of many different pirate systems before.
Pirate stations are marked in the Galactic map with a skull icon.

Step 2.
Talk to the Black Market trader. They are found to the left of the damaged hauler in the space station. Buy all their Suspicious Packets (Tech) and Suspicious Packets (Arms).

Step 3.
Using the space station teleport (or your ship’s warp drive), warp to another Pirate station. Alternatively, wait for the trader to restock later on. Repeat steps 2 and 3 until you have run out of units / have spent enough time gathering packets.

Step 4.
Unpack all the Suspicious Packets you have bought. This may take a little while but it’s very satisfying.

Step 5.
Go to the Black Market Upgrades dealer (in the tent to the right of the damaged hauler).

Step 6.
Sell off all your upgrades for around 300 nanites each.

Expected Results:
I have given this a short trial and was able to make 38000 nanites in 11 minutes at around 500 units per nanite.
Scaling this up gives around 200k nanites per hour.

If anyone tries this for longer, please let me know how well this method works!

edit: archive.org link