diff options
author | tv <tv@krebsco.de> | 2016-02-21 20:04:45 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-02-21 21:52:05 +0100 |
commit | de5de37a12771db395f7bc1954be52f51f54b9e2 (patch) | |
tree | 11a97214d5b869507916da79bfd47e6eef109988 /krebs/3modules | |
parent | 67e5fddc0bfe624c6b53b673582e92a28cf530f9 (diff) |
krebs.dns.providers: attrsOf unspecified -> attrsOf str
Diffstat (limited to 'krebs/3modules')
-rw-r--r-- | krebs/3modules/default.nix | 14 | ||||
-rw-r--r-- | krebs/3modules/tv/default.nix | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index aeeabfe53..662fd6489 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -43,9 +43,7 @@ let dns = { providers = mkOption { - # TODO with types; tree dns.label dns.provider, so we can merge. - # Currently providers can only be merged if aliases occur just once. - type = with types; attrsOf unspecified; + type = with types; attrsOf str; }; }; @@ -95,7 +93,7 @@ let { krebs = import ./tv { inherit config lib; }; } { krebs.dns.providers = { - de.krebsco = "zones"; + "krebsco.de" = "zones"; gg23 = "hosts"; shack = "hosts"; i = "hosts"; @@ -116,13 +114,15 @@ let }; }; - networking.extraHosts = concatStringsSep "\n" (flatten ( + networking.extraHosts = let + domains = attrNames (filterAttrs (_: eq "hosts") cfg.dns.providers); + check = hostname: any (domain: hasSuffix ".${domain}" hostname) domains; + in concatStringsSep "\n" (flatten ( mapAttrsToList (hostname: host: mapAttrsToList (netname: net: let aliases = longs ++ shorts; - providers = dns.split-by-provider net.aliases cfg.dns.providers; - longs = providers.hosts; + longs = filter check net.aliases; shorts = let s = ".${cfg.search-domain}"; in map (removeSuffix s) (filter (hasSuffix s) longs); in diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix index b0011ccf7..533502914 100644 --- a/krebs/3modules/tv/default.nix +++ b/krebs/3modules/tv/default.nix @@ -4,7 +4,7 @@ with config.krebs.lib; { dns.providers = { - de.viljetic = "regfish"; + "viljetic.de" = "regfish"; }; hosts = mapAttrs (_: setAttr "owner" config.krebs.users.tv) { cd = rec { |