From f1922cdbdc608b1f1f85a1d80310b54e89d0e9f3 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 16 Aug 2020 20:48:03 +0200 Subject: [PATCH 1/2] smartmontools: fix missing hostname in notifications This properly registers some missing dependencies of smartd_warning.sh. --- nixos/modules/services/monitoring/smartd.nix | 4 ---- pkgs/tools/system/smartmontools/default.nix | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index a3612be3cc2..2cc9f043cf0 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -239,11 +239,7 @@ in systemd.services.smartd = { description = "S.M.A.R.T. Daemon"; - wantedBy = [ "multi-user.target" ]; - - path = [ pkgs.nettools ]; # for hostname and dnsdomanname calls in smartd - serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd ${lib.concatStringsSep " " cfg.extraOptions} --no-fork --configfile=${smartdConf}"; }; diff --git a/pkgs/tools/system/smartmontools/default.nix b/pkgs/tools/system/smartmontools/default.nix index f4941df8ebd..5d9196fcc16 100644 --- a/pkgs/tools/system/smartmontools/default.nix +++ b/pkgs/tools/system/smartmontools/default.nix @@ -1,4 +1,5 @@ { stdenv, fetchurl, autoreconfHook +, mailutils, inetutils , IOKit ? null , ApplicationServices ? null }: let @@ -24,6 +25,10 @@ in stdenv.mkDerivation rec { patches = [ ./smartmontools.patch ]; postPatch = "cp -v ${driverdb} drivedb.h"; + configureFlags = [ + "--with-scriptpath=${stdenv.lib.makeBinPath [ mailutils inetutils ]}" + ]; + nativeBuildInputs = [ autoreconfHook ]; buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices]; enableParallelBuilding = true; From ea37c9caa1a07d1cc1d4fa915959e14d77594238 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 16 Aug 2020 20:48:42 +0200 Subject: [PATCH 2/2] smartmontools: use standard subject in notification emails This makes the notification script use the subject generated by smartmontools itself both for consistency with other distros and to include the hostname. --- nixos/modules/services/monitoring/smartd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index 2cc9f043cf0..c72b4abfcdc 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -20,7 +20,7 @@ let ${pkgs.coreutils}/bin/cat << EOF From: smartd on ${host} <${nm.sender}> To: undisclosed-recipients:; - Subject: SMART error on $SMARTD_DEVICESTRING: $SMARTD_FAILTYPE + Subject: $SMARTD_SUBJECT $SMARTD_FULLMESSAGE EOF