Based on the OpenZFS Root on ZFS page, I wrote a zfs deployment (or rather, a “deploy NixOS on ZFS”) script. I tested it with qemu (/dev/vda) and vmware (/dev/sda) so far, and it works pretty well on there.
I specified the differences and other notes in the README.md. It’s still kind of a work in progress, but I hope this is a welcome addition to the tools people can use for NixOS.
relatime is “fine” for “most” general-purpose data (that isn’t a mail spool or some kinds of cache dir).
atime=off is a stronger condition, and I wouldn’t recommend in general, but is a good idea for the nix store dataset specifically, because atimes are not used there.
I have also used the OpenZFS guide to install NixOS on a ZFS root. One issue I ran into was that the guide assumes modifying hardware-configuration.nix, which is suboptimal as the file will be overwritten by nixos-generate-config. And without options = [ "zfsutil" "X-mount.mkdir" ] for fileSystem entries ZFS mountpoints conflict with Systemd mounts: they attempt to mount ZFS datasets using mount rather than zfs mount. In the end I opted for using legacy mountpoints for the problematic datasets.