{ pkgs, config, lib, ... }: let cfg = config.holocron.zfs; sec = config.sops.secrets; in { options.holocron.zfs = { enable = lib.mkEnableOption "enables zfs"; }; config = lib.mkIf cfg.enable { # set network host id # enable zfs support boot.kernelModules = ["zfs"]; boot.supportedFilesystems = ["zfs"]; boot.zfs.forceImportRoot = false; # boot.initrd.services.zfs.enable = true; # boot.zfs.requestEncryptionCredentials = true; # arc cache size boot.kernelParams = ["zfs.zfs_arc_max=12884901888"]; # pools to import boot.zfs.extraPools = ["holocron"]; # enable smart monitoring services.smartd = { enable = true; autodetect = true; defaults.monitored = "-a -o on -s (S/../.././05|L/../01/./05)"; notifications = { test = false; mail = { enable = true; recipient = "blake"; sender = "alerts@blakedheld.xyz"; }; }; }; # enable zfs services.zfs = { autoScrub.enable = true; autoScrub.interval = "weekly"; autoSnapshot = { enable = true; frequent = 4; # 15 min snapshots hourly = 24; # hourly snapshots daily = 7; # daily snapshots weekly = 4; # weekly snapshots monthly = 12; # monthly snapshots }; # email notifs zed = { enableMail = true; settings = { ZED_EMAIL_ADDR = ["root" "blake"]; # send notification if scrub succeeds ZED_NOTIFY_VERBOSE = true; }; }; }; # install userspace tools for smart environment.systemPackages = with pkgs; [smartmontools]; }; }