9 inherit (config.services.mailpit) instances;
23 isNonNull = v: v != null;
25 settings: concatStringsSep " " (cli.toGNUCommandLine { } (filterAttrs (const isNonNull) settings));
28 options.services.mailpit.instances = mkOption {
30 type = types.attrsOf (
32 freeformType = types.attrsOf (
41 type = types.nullOr types.str;
43 example = "mailpit.db";
45 Specify the local database filename to store persistent data.
46 If `null`, a temporary file will be created that will be removed when the application stops.
47 It's recommended to specify a relative path. The database will be written into the service's
52 type = types.ints.unsigned;
55 Maximum number of emails to keep. If the number is exceeded, old emails
58 Set to `0` to never prune old emails.
62 default = "127.0.0.1:8025";
65 HTTP bind interface and port for UI.
69 default = "127.0.0.1:1025";
72 SMTP bind interface and port.
79 Configure mailpit instances. The attribute-set values are
80 CLI flags passed to the `mailpit` CLI.
82 See [upstream docs](https://mailpit.axllent.org/docs/configuration/runtime-options/)
83 for all available options.
87 config = mkIf (instances != { }) {
88 systemd.services = mapAttrs' (
90 nameValuePair "mailpit-${name}" {
91 wantedBy = [ "multi-user.target" ];
92 after = [ "network-online.target" ];
93 wants = [ "network-online.target" ];
96 StateDirectory = "mailpit";
97 WorkingDirectory = "%S/mailpit";
98 ExecStart = "${getExe pkgs.mailpit} ${genCliFlags cfg}";
99 Restart = "on-failure";
105 meta.maintainers = lib.teams.flyingcircus.members;