{ config, ... }:
let secrets = config.services.secrets.secrets;
in {
  config.mailserver = {
    enable = true;
    fqdn = "mail.owo.monster";
    domains = [ "owo.monster" "kitteh.pw" ];

    debug_mode = true;
    extra_roundcube_config = ''
      $config['session_lifetime'] = (60 * 24 * 7 * 2); # 2 Weeks
      $config['product_name'] = 'Chaos Mail';
      $config['username_domain'] = "owo.monster";
      $config['username_domain_forced'] = true;
    '';

    accounts = {
      "chaos@owo.monster" = {
        name = "chaos@owo.monster";
        passwordFile = "${secrets.chaos_mail_passwd.path}";
        aliases = [
          "all@owo.monster"
          "chaoticryptidz@owo.monster"

          # TODO: legacy - to be deprecated by 2023-01-01 
          "kitteh@owo.monster"
          "kitteh@kitteh.pw"
        ];
        sieveScript = null;
      };
      "misskey@owo.monster" = {
        name = "misskey@owo.monster";
        passwordFile = "${secrets.misskey_mail_passwd.path}";
        aliases = [ ];
        sieveScript = null;
      };
      "system@owo.monster" = {
        name = "system@owo.monster";
        passwordFile = "${secrets.system_mail_passwd.path}";
        aliases = [ ];
        sieveScript = null;
      };
    };
  };
}