{ config, lib, ... }: let cfg = config.os.srv.zfs; in { options.os.srv.zfs.enable = lib.mkEnableOption "enables zfs drive maintnance"; config = lib.mkIf cfg.enable { assertions = [ { assertion = config.os.core.drivers.kernel == "zfs"; message = "ZFS requires the zfs supported kernel"; } ]; boot = { kernelParams = [ "zfs.zfs_arc_max=34359738368" ]; supportedFilesystems = [ "zfs" ]; initrd = { supportedFilesystems = [ "zfs" ]; # fileSystems."/mnt" = { # device = "/dev/disk/by-label/KEYS"; # fsType = "vfat"; # options = [ "ro" ]; # }; }; }; services.zfs = { autoScrub = { enable = true; interval = "weekly"; }; trim.enable = true; zed = { enableMail = true; settings = { ZED_DEBUG_LOG = "/var/log/zed.debug.log"; ZED_EMAIL_ADDR = [ "adikro@disroot.org" ]; ZED_EMAIL_PROG = "mail"; ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@"; ZED_NOTIFY_INTERVAL_SECS = 3600; ZED_NOTIFY_VERBOSE = false; ZED_USE_ENCLOSURE_LEDS = true; ZED_SCRUB_AFTER_RESILVER = false; }; }; }; networking.hostId = "4e3e22e1"; }; }