Stalwart

From NixOS Wiki
Revision as of 12:40, 4 December 2023 by imported>Onny (Inital page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Setup

 
/etc/nixos/configuration.nix
services.stalwart-mail = {
  enable = true;
  settings = {
    certificate."snakeoil" = {
      cert = "file://${certs.${domain}.cert}";
      private-key = "file://${certs.${domain}.key}";
    };
    server = {
      hostname = domain;
      tls = {
        certificate = "snakeoil";
        enable = true;
        implicit = false;
      };
      listener = {
        "smtp-submission" = {
          bind = [ "[::]:587" ];
          protocol = "smtp";
        };
        "imap" = {
          bind = [ "[::]:143" ];
          protocol = "imap";
        };
      };
      session = {
        rcpt.directory = "in-memory";
        auth = {
          mechanisms = [ "PLAIN" ];
          directory = "in-memory";
        };
      };
      jmap.directory = "in-memory";
      queue.outbound.next-hop = [ "local" ];
      directory."in-memory" = {
        type = "memory";
        users = [
          {
            name = "alice";
            secret = "foobar";
            email = [ "alice@${domain}" ];
          }
          {
            name = "bob";
            secret = "foobar";
            email = [ "bob@${domain}" ];
          }
        ];
      };
    };
  };
};