Well, Paperless-NGX keeps the original documents in their original format in a separate directory, and only keeps meta-data in the database, but it was still a pain to have to use the old set-up to export the data to a back-up and then go back to the new setup to import it.
The good thing is that NixOS makes that sort of thing trivial, but the obvious trivial way didn't work due to weird version issues, so I had to go for a slightly non-obvious way that may not have worked.