{ config, lib, ... }:

with lib;
{
  mx = [ "smtp.informis.land" ];

  aliases = {
    smtp   = "procul.informis.land.";
    imap   = "procul.informis.land.";
    gemini = "procul.informis.land.";
    git    = "procul.informis.land.";
  };

  verbatim-dns-records = let
    domain-name = config.fudo.hosts.${config.instance.hostname}.domain;
    # NOTE: we're assuming IPv4...
    domain-local-nets = map (network: "ip4:${network}") config.fudo.domains.${domain-name}.local-networks;
    local-net-string = concatStringsSep " " domain-local-nets;
  in [
    ''@ IN TXT "v=spf1 mx ${local-net-string} -all"''
    ''@ IN SPF "v=spf1 mx ${local-net-string} -all"''
  ];

  srv-records = {
    tcp = {
      domain = [{
        host = "ns1.informis.land";
        port = 53;
      }];
      ssh = [{
        host = "procul.informis.land";
        port = 22;
      }];
      submission = [{
        host = "procul.informis.land";
        port = 587;
      }];
      kerberos = [{
        host = "procul.informis.land";
        port = 88;
      }];
      kerberos-adm = [{
        host = "procul.informis.land";
        port = 749;
      }];
      imaps = [{
        host = "procul.informis.land";
        port = 993;
        priority = 0;
      }];
      pop3s = [{
        host = "procul.informis.land";
        port = 995;
        priority = 10;
      }];
      http = [{
        host = "procul.informis.land";
        port = 80;
      }];
      https = [{
        host = "procul.informis.land";
        port = 443;
      }];
    };

    udp = {
      domain = [{
        host = "ns1.informis.land";
        port = 53;
      }];
      kerberos = [{
        host = "procul.informis.land";
        port = 88;
      }];
      kerberos-master = [{
        host = "procul.informis.land";
        port = 88;
      }];
      kpasswd = [{
        host = "procul.informis.land";
        port = 464;
      }];
    };
  };
  
  hosts = {
    procul = {
      ipv4-address = "172.86.179.18";
    };
  };
}