summary refs log tree commit diff
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2021-01-13 23:40:46 -0800
committerCole Helbling <cole.e.helbling@outlook.com>2021-02-06 22:04:00 -0800
commit1ed5b6a285301a0ef17bbb8378ec43a6a79b3520 (patch)
tree86877eed033ae4fde9661b158d438e5db1891622
parenta206194b4ec06da05f08c9b02eab4f574498df6b (diff)
downloadnixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar.gz
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar.bz2
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar.lz
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar.xz
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.tar.zst
nixpkgs-1ed5b6a285301a0ef17bbb8378ec43a6a79b3520.zip
zfs: disable smartmontools mail functionality
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix12
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix25
2 files changed, 27 insertions, 10 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index f153cce4c72..59676e99678 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -327,7 +327,9 @@ in
     };
 
     services.zfs.zed = {
-      enableMail = mkEnableOption "ZED's ability to send emails";
+      enableMail = mkEnableOption "ZED's ability to send emails" // {
+        default = cfgZfs.package.enableMail;
+      };
 
       settings = mkOption {
         type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
@@ -363,6 +365,14 @@ in
     (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";
         }
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index a66520b6fa1..202dc9091fd 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -8,8 +8,8 @@
 , libtirpc
 , nfs-utils
 , gawk, gnugrep, gnused, systemd
-, smartmontools, sysstat, sudo
-, pkg-config
+, smartmontools, enableMail ? false
+, sysstat, sudo, pkg-config
 
 # Kernel dependencies
 , kernel ? null
@@ -18,6 +18,8 @@
 
 with lib;
 let
+  smartmon = smartmontools.override { inherit enableMail; };
+
   buildKernel = any (n: n == configFile) [ "kernel" "all" ];
   buildUser = any (n: n == configFile) [ "user" "all" ];
 
@@ -148,7 +150,7 @@ let
       '';
 
       postFixup = let
-        path = "PATH=${makeBinPath [ coreutils gawk gnused gnugrep util-linux smartmontools sysstat ]}:$PATH";
+        path = "PATH=${makeBinPath [ coreutils gawk gnused gnugrep util-linux smartmon sysstat ]}:$PATH";
       in ''
         for i in $out/libexec/zfs/zpool.d/*; do
           sed -i '2i${path}' $i
@@ -157,12 +159,17 @@ let
 
       outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ];
 
-      passthru.tests = if isUnstable then
-        [ nixosTests.zfs.unstable ]
-      else [
-        nixosTests.zfs.installer
-        nixosTests.zfs.stable
-      ];
+      passthru = {
+        inherit enableMail;
+
+        tests =
+          if isUnstable then [
+            nixosTests.zfs.unstable
+          ] else [
+            nixosTests.zfs.installer
+            nixosTests.zfs.stable
+          ];
+      };
 
       meta = {
         description = "ZFS Filesystem Linux Kernel module";