0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

Merge pull request #109345 from cole-h/zfs-closure

Shrink the ZFS closure by making mail support optional
This commit is contained in:
Linus Heckemann 2021-02-10 23:04:24 +01:00 committed by GitHub
commit e4cf0e7a45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 32 deletions

View file

@ -326,30 +326,36 @@ in
};
};
services.zfs.zed.settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
example = literalExample ''
{
ZED_DEBUG_LOG = "/tmp/zed.debug.log";
services.zfs.zed = {
enableMail = mkEnableOption "ZED's ability to send emails" // {
default = cfgZfs.package.enableMail;
};
ZED_EMAIL_ADDR = [ "root" ];
ZED_EMAIL_PROG = "mail";
ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
example = literalExample ''
{
ZED_DEBUG_LOG = "/tmp/zed.debug.log";
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = false;
ZED_EMAIL_ADDR = [ "root" ];
ZED_EMAIL_PROG = "mail";
ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
ZED_USE_ENCLOSURE_LEDS = true;
ZED_SCRUB_AFTER_RESILVER = false;
}
'';
description = ''
ZFS Event Daemon /etc/zfs/zed.d/zed.rc content
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = false;
See
<citerefentry><refentrytitle>zed</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for details on ZED and the scripts in /etc/zfs/zed.d to find the possible variables
'';
ZED_USE_ENCLOSURE_LEDS = true;
ZED_SCRUB_AFTER_RESILVER = false;
}
'';
description = ''
ZFS Event Daemon /etc/zfs/zed.d/zed.rc content
See
<citerefentry><refentrytitle>zed</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for details on ZED and the scripts in /etc/zfs/zed.d to find the possible variables
'';
};
};
};
@ -358,6 +364,14 @@ in
config = mkMerge [
(mkIf cfgZfs.enabled {
assertions = [
{
assertion = cfgZED.enableMail -> cfgZfs.package.enableMail;
message = ''
To allow ZED to send emails, ZFS needs to be configured to enable
this. To do so, one must override the `zfs` package and set
`enableMail` to true.
'';
}
{
assertion = config.networking.hostId != null;
message = "ZFS requires networking.hostId to be set";
@ -437,7 +451,7 @@ in
};
services.zfs.zed.settings = {
ZED_EMAIL_PROG = mkDefault "${pkgs.mailutils}/bin/mail";
ZED_EMAIL_PROG = mkIf cfgZED.enableMail (mkDefault "${pkgs.mailutils}/bin/mail");
PATH = lib.makeBinPath [
cfgZfs.package
pkgs.coreutils