diff --git a/configuration.nix b/configuration.nix index 16b7f8e..8bcf5de 100644 --- a/configuration.nix +++ b/configuration.nix @@ -101,6 +101,7 @@ in { secrets.wireguard.file = secrets/wireguard.age; secrets.syncthing.file = secrets/syncthing.age; secrets.samba-ugent.file = secrets/samba-ugent.age; + secrets.msmtp.file = secrets/msmtp.age; identityPaths = [ "/etc/ssh/id_ed25519" ]; }; @@ -159,6 +160,7 @@ in { ./modules/printing.nix ./modules/periodic.nix ./modules/power.nix + ./modules/monitoring.nix ./overlays/nix-direnv.nix ./overlays/openconnect-sso.nix ./overlays/cyrus-sasl-oauth2.nix diff --git a/modules/monitoring.nix b/modules/monitoring.nix new file mode 100644 index 0000000..917e495 --- /dev/null +++ b/modules/monitoring.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +{ + # Notify when a disk starts going haywire + services.smartd = { + enable = true; + notifications.mail = { + enable = true; + sender = "akasroua+smartd@disroot.org"; + recipient = "akasroua@disroot.org"; + mailer = "${pkgs.msmtp}/bin/msmtp -t --read-envelope-from"; + }; + }; + + # Set up msmtp as notifier + programs.msmtp = { + enable = true; + defaults = { + port = 587; + tls = true; + }; + accounts = { + default = { + auth = true; + host = "disroot.org"; + user = "akasroua@disroot.org"; + passwordeval = + "${pkgs.coreutils}/bin/cat ${config.age.secrets.msmtp.path}"; + }; + }; + }; + +} diff --git a/secrets/msmtp.age b/secrets/msmtp.age new file mode 100644 index 0000000..f4ee902 --- /dev/null +++ b/secrets/msmtp.age @@ -0,0 +1,8 @@ +age-encryption.org/v1 +-> ssh-ed25519 G5UUhw yZ6q0+opG1dPd+bziS6EK4Da2R1HI4SN5CNZTFR0NFI +xx6fet9CzAuWdwEzQrR7qc6DJZDPUM+Ug995OHJnO+w +-> -ENU/-grease sB@d>Z >aJ^$RPzS!<>#Ϟh \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index bdb192d..05e1bd0 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -5,4 +5,5 @@ in { "wireguard.age".publicKeys = [ coolneng ]; "syncthing.age".publicKeys = [ coolneng ]; "samba-ugent.age".publicKeys = [ coolneng ]; + "msmtp.age".publicKeys = [ coolneng ]; }