22 inherit (config.lib.mylib)
26 hostname = config.networking.hostName;
27 maybe = optionalAttrs (
31 mx-webroot = pkgs.writeTextDir "index.html" ''
34 <head><title>Hello</title></head>
35 <body>Hello World!</body>
39 email-accounts = binding
43 email = "${conf.name or key}@func.xyz";
44 hashedPassword = conf.hashedPassword or "!";
48 (trace "serving email ${email}" email)
49 { inherit hashedPassword quota; }
54 (conf.name or "") != "root" &&
55 (conf.isNormalUser or (! (conf.isSystemUser or false)))
58 (config.users.users or { }) //
59 (config.users.extraUsers or { })
66 "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/24128c30.tar.gz" # for nixos-23.05
70 security.acme = maybe {
72 defaults.email = "gerald.mouse@func.xyz";
75 services.nginx = maybe {
76 virtualHosts."${config.mailserver.fqdn}" = {
77 root = "${mx-webroot}";
83 enable = trace "Enable mailserver of SNM" true;
85 sendingFqdn = "mx.func.xyz";
86 domains = [ "func.xyz" ];
90 loginAccounts = email-accounts;
92 # Use Let's Encrypt certificates. Note that this needs to set up a stripped
93 # down nginx and opens port 80.
94 certificateScheme = "acme-nginx";
95 # Enable flags of IMAP, POP3 and SMTP
97 enableImapSsl = false;
100 enableSubmission = true;
101 enableSubmissionSsl = true;
103 # Enable the ManageSieve protocol
104 enableManageSieve = false;
105 # whether to scan inbound emails for viruses (note that this requires at least
106 # 1 Gb RAM for the server. Without virus scanning 256 MB RAM should be plenty)
107 virusScanning = false;
111 services.stalwart-mail = {