ITADN

Managing only partial domain records

#19Openndarilek 创建于 2024-12-12
N
ndarilekcommented
This looks like a neat project. I'm struggling to figure out if it meets my use case. My domain, example.com, has its DNS hosted with Cloudflare and I've created all the records with Pulumi. Unfortunately my Pulumi state got hosed so I'm looking to try migrating to this project. I brought up a Nix server, hostname hub. I'd like to assign hub.example.com to its IP address declaratively. I have a flake-based config with each host in its own file. My initial goal is to try generating zone files to see if they look sensible/correct, then try working with cloudflare through octodns. I'm not sure which combination of baseDomains, subDomains and/or zones I need to pull this off. Here's what I have in flake.nix: ``` let ... dnsConfig = { # inherit nixosConfigurations; extraConfig = import ./dns.nix; }; in ... packages = forAllSystems ( system: let generate = nixos-dns.utils.generate nixpkgs.legacyPackages.${system}; in { # nix build .#zoneFiles zoneFiles = generate.zoneFiles dnsConfig; } ); ``` Then I have this dns.nix: ``` { defaultTTL = 60; zones = { "example.com" = { }; }; } ``` Then this individual host config: ``` networking = { hostName = "hub"; hostId = "91312b0a"; usePredictableInterfaceNames = false; domains = { enable = true; baseDomains = { "hub.example.com" = { a.data = "MY IP HERE"; }; }; }; }; ``` When I build zones to sanity-check the result before trying to add octodns, I get an empty file. I can configure the zones if I make the config exactly like the example, but I'd rather not keep it all in dns.nix--I'd rather keep the config for each server with the server. Here's what I don't get: 1. Is what I want possible with this project? (E.g. only configuring this specific subdomain and gradually migrating more domains over time.) 2. If so, what's the minimum I'd need to assign an A record to hub.example.com in a specific host configuration? 3. Can I generate a zone file with this config to sanity-check it first, or would that not work here? (E.g. maybe that only works if I'm configuring everything from the apex down?) Thanks a bunch.
1 条评论