about summary refs log tree commit diff
path: root/modules/nixos
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/default.nix1
-rw-r--r--modules/nixos/nullmailer.nix28
2 files changed, 29 insertions, 0 deletions
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;
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3