diff options
Diffstat (limited to 'os/srv/zfs.nix')
| -rw-r--r-- | os/srv/zfs.nix | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/os/srv/zfs.nix b/os/srv/zfs.nix new file mode 100644 index 0000000..fadfd82 --- /dev/null +++ b/os/srv/zfs.nix @@ -0,0 +1,52 @@ +{ 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"; + }; +} |
