1 { pkgs, lib, config, ... }:
6 boot.supportedFilesystems = [ "zfs" ];
8 # The 32-bit host id of the machine, formatted as 8 hexadecimal characters.
9 # You should try to make this id unique among your machines.
10 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
11 networking.hostId = "69c40b03";
13 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
14 # and/or for SSD, whereas HDD could use mq-deadline.
15 services.udev.extraRules = ''
16 # set none scheduler for non-rotating disks
17 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
20 # Ensure extra safeguards are active that zfs uses to protect zfs pools.
21 boot.zfs.forceImportAll = false;
22 boot.zfs.forceImportRoot = false;
24 boot.zfs.enableUnstable = true;
25 boot.zfs.requestEncryptionCredentials = true;
27 # Enables periodic scrubbing of ZFS pools.
28 services.zfs.autoScrub.enable = true;
38 # Enable the (OpenSolaris-compatible) ZFS auto-snapshotting service.
39 services.zfs.autoSnapshot = {
51 { device = "bpool/boot";
56 { device = "rpool/root";
61 { device = "rpool/home";
66 { device = "rpool/nix";
71 { device = "rpool/var";
75 fileSystems."/var/cache" =
76 { device = "rpool/var/cache";
80 fileSystems."/var/log" =
81 { device = "rpool/var/log";
85 fileSystems."/var/tmp" =
86 { device = "rpool/var/tmp";