From 773ba5e5ea810f104127b7ca28e541875f763599 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Mon, 20 Mar 2023 18:39:29 +0300 Subject: 2023-03-20 --- modules/nixos/default.nix | 1 + modules/nixos/nullmailer.nix | 28 ++++++++++++++++++++++++++++ nixosConfigurations/eonwe/default.nix | 19 ++++++------------- nixosConfigurations/manwe/mailserver.nix | 1 + 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 modules/nixos/nullmailer.nix diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 8ac9a29..269ce39 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -36,6 +36,7 @@ _: { ./nginx.nix ./node-exporter.nix ./nsd.nix + ./nullmailer.nix ./openssh.nix ./podman.nix ./postgresql.nix diff --git a/modules/nixos/nullmailer.nix b/modules/nixos/nullmailer.nix new file mode 100644 index 0000000..193b109 --- /dev/null +++ b/modules/nixos/nullmailer.nix @@ -0,0 +1,28 @@ +{ + config, + inputs, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.nullmailer; +in { + options.nixfiles.modules.nullmailer.enable = mkEnableOption "Nullmailer"; + + config = mkIf cfg.enable { + # No use in enabling it other than having a retry queue. + # ark.directories = ["/var/spool/nullmailer"]; + + secrets.nullmailer-remotes = with config.services.nullmailer; { + file = "${inputs.self}/secrets/nullmailer-remotes"; + owner = user; + inherit group; + }; + + services.nullmailer = { + enable = true; + remotesFile = config.secrets.nullmailer-remotes.path; + config.me = config.networking.domain; + }; + }; +} diff --git a/nixosConfigurations/eonwe/default.nix b/nixosConfigurations/eonwe/default.nix index 3476e6d..e5080c3 100644 --- a/nixosConfigurations/eonwe/default.nix +++ b/nixosConfigurations/eonwe/default.nix @@ -25,6 +25,7 @@ with lib; { libvirtd.enable = true; qutebrowser.enable = true; mpd.enable = true; + nullmailer.enable = true; }; hm = { @@ -49,21 +50,13 @@ with lib; { services.mpd.musicDirectory = mkForce "/mnt/udata/music"; }; - services = { - smartd = { + services.smartd = { + enable = true; + notifications.mail = { enable = true; - notifications = { - test = true; - mail = { - # TODO - }; - }; + sender = "admin+smartd@${my.domain.shire}"; + recipient = "admin+smartd@${my.domain.shire}"; }; - - # nullmailer = { - # enable = true; - # me = config.networking.fqdn; - # }; }; # Usually stuff that is going to be compiled on this machine is going to have diff --git a/nixosConfigurations/manwe/mailserver.nix b/nixosConfigurations/manwe/mailserver.nix index f6f8d91..e8d1781 100644 --- a/nixosConfigurations/manwe/mailserver.nix +++ b/nixosConfigurations/manwe/mailserver.nix @@ -63,6 +63,7 @@ with lib; { "admin@${shire}" "ceo@${shire}" "postmaster@${shire}" + "root@${shire}" ]; }; "samwise@${shire}" = { -- cgit 1.4.1