{ mailserver, config, pkgs, ... }: 
{
  imports = [
    ./nginx
    mailserver.nixosModule
  ];

  mailserver = rec {
    enable = config.system.mailserver.enable;
    domains = [
      "nixfox.ca"
      "bloxelcom.net"
      "freecorn1854.win"
      "lunamoonlight.xyz"
    ];
    fqdn = "mx.nixfox.ca";
    certificateScheme = "acme-nginx";
    localDnsResolver = false;
    redis.port = 1515;

    # Passwords made with 'mkpasswd -sm bcrypt'
    loginAccounts = {
      "noreply@nixfox.ca" = {
        hashedPasswordFile = pkgs.writeText "noreply" config.secrets.noreplyMailHash;
        sendOnly = true;
      };    
      "jimbo@nixfox.ca" = {
        hashedPasswordFile = pkgs.writeText "jimbo" config.secrets.jimboMailHash;
        aliases = [
          "james@nixfox.ca"
          "jimbo@bloxelcom.net"

          "vice@nixfox.ca"
          "vice@bloxelcom.net"
          "yara@nixfox.ca"

          "contact@nixfox.ca"
        ];
      };
      "luna@lunamoonlight.xyz" = {
        hashedPasswordFile = pkgs.writeText "luna" config.secrets.lunaMailHash;
        aliases = [
          "luna@bloxelcom.net"
          "contact@bloxelcom.net"
          "ibu@bloxelcom.net"
        ];
      };
      "contact@freecorn1854.win" = {
        hashedPasswordFile = pkgs.writeText "corn" config.secrets.cornMailHash;
        aliases = [ "freecorn@bloxelcom.net" ];
      };
    };
  };

  # Rspamd port from earlier to avoid overlap
  services.redis.servers.rspamd.port = 1515;
}
