root on ZFS Install

In order to import a ZFS pool, ZFS must be enabled in the NixOS configuration file.

Make sure zfs is in boot.supportedFilesystems.

Rebuild NixOS and switch to the new configuration.

Check zfs is working,modprobe zfs should show no problems.

ZFS should now work.


Create a new pool or mount an existing pool.

Creating a pool

Create a pool using the disk ID and set it to 4k block size as default with ashift=12.

Export the pool after creation.

Using an Existing pool

The existing pool assigning it to be relative to /mnt with -R, the -N flag will tell ZFS not to mount any datasets.

Setup Datasets

Mount all datasets partitions to /mnt.


Setup datasets. Set all legacy.

Mount Datasets

Mount the datasets:


Create a 512M esp, mount to /boot

Format boot and mount.


Create a partition of desired size.

Enable swap.


Setup config in /mnt/etc/nixos and install.

nixos-install --root /mnt

Last updated