One of our most requested features is here: DNS record comments and tags
blog.cloudflare.com
blog.cloudflare.com
My approach for DNS is to use a NixOS module that describes the configuration of a zonefile [0]. Then, for example, to add an MX record for the root pointing to the `mail` subdomain, one can do:
dns.records = [
{
name = "@";
type = "MX";
data = "10 mail";
}
];
This configuration is used to create a zonefile with a Nix derivation [1] that can be provided to a DNS service [2].This has the advantage that comments and any other metadata to be included can be added here, the configuration can be version controlled and merged/reverted as appropriate, and that the DNS records for services can configured right alongside them.
It has it's limitations though. There may be implicit dependencies in the runtime of different services. It's hard to test because of this.
[0] https://github.com/RyanGibb/eilean-nix/blob/0b4213b0/modules...
[1] https://github.com/RyanGibb/eilean-nix/blob/0b4213b0/modules...
[2] https://github.com/RyanGibb/eilean-nix/blob/0b4213b0/modules...