- NixOS configurations for desktop, laptop, and server contexts
- Opt-in persistence through impermanence + blank snapshotting on boot
- Encrypted zfs partition
- Deploy secrets using agenix
- Flexible Home Manager config files
- wayland environments (plasma, river, hyprland)
- Github CI/CD and binary cache
On boot the root mount(rpool/local/root
) gets wiped to its @blank
snapshot.
To preserve directories, mount them from either the rpool/safe/data
dataset mounted to /data
or the rpool/local/cache
dataset mounted to /cache
.
/data
is for files that we want to persist and backup./cache
is for files that we want to persist.
Run src_sh{zfsdiff} tool to discover directories that will be erased on next boot.
References:
See ZFS - NixOS Wiki for more information and advanced options for configuring zpool.
- Create three partitions:
- Boot
- Swap
- ZFS
disk=/dev/disk/by-id/foo sudo parted "$disk" -- mklabel gpt sudo parted "$disk" -- mkpart primary 512MiB -8GiB # zfs sudo parted "$disk" -- mkpart primary linux-swap -8GiB 100% # swap sudo parted "$disk" -- mkpart ESP fat32 1MiB 512MiB # boot sudo parted "$disk" -- set 3 esp on sudo mkswap -L swap "${disk}-part2" sudo mkfs.fat -F 32 -n EFI "${disk}-part3"
- Create ZPool:
zpool create -O mountpoint=none -O encryption=aes-256-gcm -O keyformat=passphrase rpool "${disk}-part1"
- Create datasets and mount them:
zfs create -o mountpoint=legacy rpool/local zfs create -o mountpoint=legacy rpool/safe zfs create -o mountpoint=legacy rpool/local/root zfs snapshot rpool/local/root@blank zfs create -o mountpoint=legacy rpool/local/nix zfs set compression=lz4 rpool/local/nix zfs create -o mountpoint=legacy rpool/local/nix-store zfs set compression=lz4 rpool/local/nix-store zfs create -o mountpoint=legacy rpool/local/cache zfs set compression=lz4 rpool/local/cache zfs create -o mountpoint=legacy rpool/safe/data zfs set compression=lz4 rpool/safe/data mount -t zfs rpool/local/root /mnt mkdir -p /mnt/boot mount "${disk}-part3" /mnt/boot mkdir -p /mnt/nix/store mount -t zfs rpool/local/nix /mnt/nix mount -t zfs rpool/local/nix-store /mnt/nix/store mkdir -p /mnt/cache mount -t zfs rpool/local/cache /mnt/cache mkdir -p /mnt/data mount -t zfs rpool/safe/data /mnt/data
- Set src_nix{networking.hostId} to src_sh{cat /etc/machine-id | head -c 8}