Summary Files Commits Branches @commit @diff @stats
path: root / machines / marduk / mail.nix
blob: 94360355a85009959572ce02c7c3c605c9a38279 (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
31
32
33
34
35
36
37
38
39
# This mail server is meant to be LOCAL/INTERNAL ONLY!
# It is woefully insecure, but the plan is to be used only between devices
# on my home network, so its ok.
#
# Configuring internal mail clients:
# INCOMING SERVER
#     Protocol             : IMAP
#     Hostname             : mail.int
#     Port                 : 143
#     Connection security  : None
#     Authentication method: Normal Password
#     Username             : NAME@mail.int
# OUTGOING SERVER (SMTP)
#     Hostname             : mail.int
#     Port                 : 587
#     Connection security  : None
#     Authentication method: Normal Password
#     Username             : NAME@mail.int
{ pkgs, config, ... }: let
  inherit (config.srv) tld;
  mailDomain = "mail." + tld;
in {
  srv.slds = [ "mail" ];

  services.maddy = {
    localDomains = [ mailDomain ];

    ensureAccounts = [
      "john@${mailDomain}"
      "yorgus@${mailDomain}"
    ];
    ensureCredentials = {
      # Do not use this in production. This will make passwords world-readable
      # in the Nix store
      "john@${mailDomain}".passwordFile = "${pkgs.writeText "postmaster" "john"}";
      "yorgus@${mailDomain}".passwordFile = "${pkgs.writeText "postmaster" "yorgus"}";
    };
  };
}