NixOS Root on ZFS: use Nix-config for multi-disk

NixOS has enjoyed popularity among ZFS users thanks to
its declarative configuration and native ZFS support.
However, the installation guide used hardcoded disk
names in configuration files, which is unnecessary and
is the source of difficulties in multidisk setups.

The guide is now rewritten to leverage expressions in
the Nix language to manage multidisk setups.

Also adds instruction on replacing failed disk.

Closes #385.

Signed-off-by: Maurice Zhou <ja@apvc.uk>
This commit is contained in:
Maurice Zhou
2023-02-10 16:40:30 +01:00
committed by George Melikov
parent d8713058b3
commit cc6d72c02d
5 changed files with 651 additions and 84 deletions

View File

@@ -8,7 +8,7 @@ Preparation
#. Disable Secure Boot. ZFS modules can not be loaded if Secure Boot is enabled.
#. Download `NixOS Live Image
<https://channels.nixos.org/nixos-22.05/latest-nixos-gnome-x86_64-linux.iso>`__ and boot from it.
<https://nixos.org/download.html#download-nixos>`__ and boot from it.
#. Connect to the Internet.
#. Set root password or ``/root/.ssh/authorized_keys``.
#. Start SSH server::
@@ -17,15 +17,15 @@ Preparation
#. Connect from another computer::
ssh root@192.168.1.19
ssh root@192.168.1.91
#. Target disk
List available disks with::
ls /dev/disk/by-id/*
find /dev/disk/by-id/
If using virtio as disk bus, use ``/dev/disk/by-path/*``.
If using virtio as disk bus, use ``/dev/disk/by-path/``.
Declare disk array::
@@ -37,11 +37,10 @@ Preparation
#. Set partition size:
Set swap size. It's `recommended <https://chrisdown.name/2018/01/02/in-defence-of-swap.html>`__
to setup a swap partition. If you intend to use hibernation,
the minimum should be no less than RAM size. Skip if swap is not needed::
Set swap size, set to 1 if you don't want swap to
take up too much space::
INST_PARTSIZE_SWAP=8
INST_PARTSIZE_SWAP=4
Root pool size, use all remaining disk space if not set::