Fix VM tests.

These are cherry-picked commits from #201 so that we have working VM tests in master and can base further branches and pull requests on a state with working tests instead of constantly needing to cherry-pick again and again.

Jobset on my Hydra: https://headcounter.org/hydra/jobset/nixops/fix-vm-tests#tabs-jobs