Mostly fix NixOS build.

Docs are still broken. The rest of the problems, mostly from small
changes since NixOS was last tested, are fixed.