@@ -326,30 +326,36 @@ in
326326 };
327327 };
328328
329− services.zfs.zed.settings = mkOption {
330− type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
331− example = literalExample ''
332− {
333− ZED_DEBUG_LOG = "/tmp/zed.debug.log";
329+ services.zfs.zed = {
330+ enableMail = mkEnableOption "ZED's ability to send emails" // {
331+ default = cfgZfs.package.enableMail;
332+ };
334333
335− ZED_EMAIL_ADDR = [ "root" ];
336− ZED_EMAIL_PROG = "mail";
337− ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
334+ settings = mkOption {
335+ type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
336+ example = literalExample ''
337+ {
338+ ZED_DEBUG_LOG = "/tmp/zed.debug.log";
338339
339− ZED_NOTIFY_INTERVAL_SECS = 3600;
340− ZED_NOTIFY_VERBOSE = false;
340+ ZED_EMAIL_ADDR = [ "root" ];
341+ ZED_EMAIL_PROG = "mail";
342+ ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
341343
342− ZED_USE_ENCLOSURE_LEDS = true;
343− ZED_SCRUB_AFTER_RESILVER = false;
344− }
345− '';
346− description = ''
347− ZFS Event Daemon /etc/zfs/zed.d/zed.rc content
348−
349− See
350− <citerefentry><refentrytitle>zed</refentrytitle><manvolnum>8</manvolnum></citerefentry>
351− for details on ZED and the scripts in /etc/zfs/zed.d to find the possible variables
352− '';
344+ ZED_NOTIFY_INTERVAL_SECS = 3600;
345+ ZED_NOTIFY_VERBOSE = false;
346+
347+ ZED_USE_ENCLOSURE_LEDS = true;
348+ ZED_SCRUB_AFTER_RESILVER = false;
349+ }
350+ '';
351+ description = ''
352+ ZFS Event Daemon /etc/zfs/zed.d/zed.rc content
353+
354+ See
355+ <citerefentry><refentrytitle>zed</refentrytitle><manvolnum>8</manvolnum></citerefentry>
356+ for details on ZED and the scripts in /etc/zfs/zed.d to find the possible variables
357+ '';
358+ };
353359 };
354360 };
355361
@@ -358,6 +364,14 @@ in
358364 config = mkMerge [
359365 (mkIf cfgZfs.enabled {
360366 assertions = [
367+ {
368+ assertion = cfgZED.enableMail -> cfgZfs.package.enableMail;
369+ message = ''
370+ To allow ZED to send emails, ZFS needs to be configured to enable
371+ this. To do so, one must override the `zfs` package and set
372+ `enableMail` to true.
373+ '';
374+ }
361375 {
362376 assertion = config.networking.hostId != null;
363377 message = "ZFS requires networking.hostId to be set";
@@ -437,7 +451,7 @@ in
437451 };
438452
439453 services.zfs.zed.settings = {
440− ZED_EMAIL_PROG = mkDefault "${pkgs.mailutils}/bin/mail";
454+ ZED_EMAIL_PROG = mkIf cfgZED.enableMail (mkDefault "${pkgs.mailutils}/bin/mail");
441455 PATH = lib.makeBinPath [
442456 cfgZfs.package
443457 pkgs.coreutils