From 58d4b5a1e50f54671d17a653faeb4811a16e5bd9 Mon Sep 17 00:00:00 2001 From: Andre Date: Fri, 22 Nov 2024 12:47:18 -0500 Subject: [PATCH] Services: enable email for smartd --- hosts/Hevana/default.nix | 34 ++++++++++++++++++++++------------ modules/system/system.nix | 10 +++++++++- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/hosts/Hevana/default.nix b/hosts/Hevana/default.nix index 5b0f1fb..9a8dafd 100644 --- a/hosts/Hevana/default.nix +++ b/hosts/Hevana/default.nix @@ -36,18 +36,28 @@ in ###*** Configure your system below this line. ***### - # Enable dynamic DNS with Porkbun - services.ddclient = { - enable = true; - configFile = pkgs.writeText "ddclient.conf" '' - use=web, web=checkip.dyndns.com/, web-skip='IP Address' - protocol=porkbun - apikey=${config.secrets.networking.porkbun.api.apiKey} - secretapikey=${config.secrets.networking.porkbun.api.secretKey} - *.${config.secrets.networking.domains.primary},*.${config.secrets.networking.domains.blog} - cache=/tmp/ddclient.cache - pid=/var/run/ddclient.pid - ''; + services = { + # Enable dynamic DNS with Porkbun + ddclient = { + enable = true; + configFile = pkgs.writeText "ddclient.conf" '' + use=web, web=checkip.dyndns.com/, web-skip='IP Address' + protocol=porkbun + apikey=${config.secrets.networking.porkbun.api.apiKey} + secretapikey=${config.secrets.networking.porkbun.api.secretKey} + *.${config.secrets.networking.domains.primary},*.${config.secrets.networking.domains.blog} + cache=/tmp/ddclient.cache + pid=/var/run/ddclient.pid + ''; + }; + + # Monitor RAID drives using SMART + smartd.devices = [ + { device = "/dev/sda"; } + { device = "/dev/sdb"; } + { device = "/dev/sdc"; } + { device = "/dev/sdd"; } + ]; }; # Configure the system. diff --git a/modules/system/system.nix b/modules/system/system.nix index d5b3c46..e55b807 100644 --- a/modules/system/system.nix +++ b/modules/system/system.nix @@ -58,7 +58,15 @@ in smartd = { enable = true; autodetect = true; - notifications.wall.enable = true; + notifications = { + wall.enable = true; + mail = lib.mkIf config.aux.system.services.msmtp.enable { + enable = true; + mailer = "/run/wrappers/bin/sendmail"; + sender = "${config.networking.hostName}@${config.secrets.networking.domains.primary}"; + recipient = config.secrets.users.aires.email; + }; + }; }; };