At the end of Series V, in Red Dwarf, we see them battling the Despair Squid. Then, in the next episode, they are revived after 200 years in suspended animation and the Red Dwarf has been gone all that time (it was not there when they got back to where it should be after facing the Despair Squid). Later we find out this was all due to the nanites.
Now I know Red Dwarf is not big on continuity, but I've never been clear. Just where did the nanites come from and what were they made for? I got the impression they were onboard the Red Dwarf for maintenance and were part of the ship, or part of the tools included with the ship and they essentially went rogue.
Where did they come from? What was the reason they were created? And when were they first mentioned? Was there any hint of their existence before Psirens, when the Large Rouge One vanishes?