zfs: disable smartmontools mail functionality

This commit is contained in:
Cole Helbling 2021-01-13 23:40:46 -08:00
parent a206194b4e
commit 1ed5b6a285
No known key found for this signature in database
GPG Key ID: B37E0F2371016A4C
2 changed files with 27 additions and 10 deletions

View File

@ -327,7 +327,9 @@ in
}; };
services.zfs.zed = { 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 { settings = mkOption {
type = with types; attrsOf (oneOf [ str int bool (listOf str) ]); type = with types; attrsOf (oneOf [ str int bool (listOf str) ]);
@ -362,6 +364,14 @@ in
config = mkMerge [ config = mkMerge [
(mkIf cfgZfs.enabled { (mkIf cfgZfs.enabled {
assertions = [ 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; assertion = config.networking.hostId != null;
message = "ZFS requires networking.hostId to be set"; message = "ZFS requires networking.hostId to be set";

View File

@ -8,8 +8,8 @@
, libtirpc , libtirpc
, nfs-utils , nfs-utils
, gawk, gnugrep, gnused, systemd , gawk, gnugrep, gnused, systemd
, smartmontools, sysstat, sudo , smartmontools, enableMail ? false
, pkg-config , sysstat, sudo, pkg-config
# Kernel dependencies # Kernel dependencies
, kernel ? null , kernel ? null
@ -18,6 +18,8 @@
with lib; with lib;
let let
smartmon = smartmontools.override { inherit enableMail; };
buildKernel = any (n: n == configFile) [ "kernel" "all" ]; buildKernel = any (n: n == configFile) [ "kernel" "all" ];
buildUser = any (n: n == configFile) [ "user" "all" ]; buildUser = any (n: n == configFile) [ "user" "all" ];
@ -148,7 +150,7 @@ let
''; '';
postFixup = 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 '' in ''
for i in $out/libexec/zfs/zpool.d/*; do for i in $out/libexec/zfs/zpool.d/*; do
sed -i '2i${path}' $i sed -i '2i${path}' $i
@ -157,12 +159,17 @@ let
outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ]; outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ];
passthru.tests = if isUnstable then passthru = {
[ nixosTests.zfs.unstable ] inherit enableMail;
else [
nixosTests.zfs.installer tests =
nixosTests.zfs.stable if isUnstable then [
]; nixosTests.zfs.unstable
] else [
nixosTests.zfs.installer
nixosTests.zfs.stable
];
};
meta = { meta = {
description = "ZFS Filesystem Linux Kernel module"; description = "ZFS Filesystem Linux Kernel module";