{ config, lib, ... }: with lib; let inherit (config.local.ns.server) tsigName; in { options.local.ns.zones = mkOption { type = with lib.types; attrsOf (submodule ({ config, name, ... }: let cfg = config.localNS; in { options.localNS = { enable = mkEnableOption "local NS settings"; primary = mkOption { type = str; }; }; config = mkIf cfg.enable { # https://docs.gandi.net/en/domain_names/advanced_users/secondary_nameserver.html nsdConfig = let gandiSecondary = [ "37.205.15.45 ${tsigName}" # ns3.vpsfree.cz "37.205.11.85 ${tsigName}" # ns4.vpsfree.cz "2a03:3b40:fe:2be::1 ${tsigName}" # ns3.vpsfree.cz "2a03:3b40:101:4::1 ${tsigName}" # ns4.vpsfree.cz ]; in { notify = gandiSecondary; provideXFR = gandiSecondary; }; ns = [ { name = "@"; host = cfg.primary; } { name = "@"; host = "ns3.vpsfree.cz."; } { name = "@"; host = "ns4.vpsfree.cz."; } ]; a = [ { name = cfg.primary; ipv4 = "37.205.12.147"; } ]; aaaa = [ { name = cfg.primary; ipv6 = "2a03:3b40:fe:3ec::1"; } ]; }; })); }; }