about summary refs log tree commit diff
path: root/modules/nixos/nullmailer.nix
blob: 9f7b4ac3709ad0d203b6d43dd7d5cdfb3ab781da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  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