]> Git — Sourcephile - julm/julm-nix.git/blob - nixos/profiles/zfs.nix
video: disable gstreamer
[julm/julm-nix.git] / nixos / profiles / zfs.nix
1 { pkgs, lib, hostName, ... }:
2 {
3 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
4 # and/or for SSD, whereas HDD could use mq-deadline.
5 services.udev.extraRules = ''
6 ACTION=="add|change", KERNEL=="sd[a-z]*[0-9]*|mmcblk[0-9]*p[0-9]*|nvme[0-9]*n[0-9]*p[0-9]*", ENV{ID_FS_TYPE}=="zfs_member", ATTR{../queue/scheduler}="none"
7 ACTION=="add|change", KERNEL=="sd[a-z][0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
8 ACTION=="add|change", KERNEL=="nvme[0-9]*n[0-9]*p[0-9]*", ATTR{../queue/rotational}=="0", ATTR{../queue/scheduler}="none"
9 '';
10
11 boot.supportedFilesystems = [ "zfs" ];
12 boot.initrd.supportedFilesystems = [ "zfs" ];
13
14 # Using ZFS together with hibernation (suspend to disk)
15 # may cause filesystem corruption.
16 # See https://github.com/openzfs/zfs/issues/260
17 boot.kernelParams = [ "nohibernate" ];
18
19 # Stable enough, clearer, and faster than the default /dev/disk/by-id
20 boot.zfs.devNodes = "/dev/disk/by-partlabel";
21 # Not useful so far.
22 boot.zfs.forceImportAll = false;
23 # More resilient for remote hosts,
24 # though it may call zpool clear.
25 boot.zfs.forceImportRoot = true;
26 boot.zfs.requestEncryptionCredentials = lib.mkDefault [ "${hostName}/root" ];
27
28 boot.zfs.enableUnstable = false;
29
30 # Enables periodic scrubbing of ZFS pools.
31 services.zfs.autoScrub.enable = true;
32 services.zfs.autoScrub.interval = "Sun *-*-08..14 00:15:00";
33
34 # According to zpool(8), for consumer hardware
35 # periodic manual TRIM is preferred over the automatic TRIM
36 # that ZFS implements.
37 services.zfs.trim.enable = true;
38 services.zfs.trim.interval = "Sun *-*-01..07 00:15:00";
39
40 environment.systemPackages = [
41 pkgs.lzop # For remote syncoid
42 pkgs.mbuffer # For remote syncoid
43 pkgs.sanoid
44 ];
45 }