diff options
author | tv <tv@krebsco.de> | 2019-01-21 10:32:15 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-21 10:33:23 +0100 |
commit | da79d23ebbc0c3fb7c579b366f29fb3744948706 (patch) | |
tree | 5f1e25928385b7588e37ad4525e4d14391818190 | |
parent | 9082adf6878b5f917efc633cba63932d94942d13 (diff) |
krebs: move dns stuff to dedicated file
-rw-r--r-- | krebs/3modules/default.nix | 26 | ||||
-rw-r--r-- | krebs/3modules/dns.nix | 12 | ||||
-rw-r--r-- | lass/2configs/default.nix | 1 | ||||
-rw-r--r-- | makefu/2configs/default.nix | 1 |
4 files changed, 20 insertions, 20 deletions
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 7b0f4ebf8..21d68ef3f 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -18,6 +18,7 @@ let ./charybdis.nix ./ci.nix ./current.nix + ./dns.nix ./exim.nix ./exim-retiolum.nix ./exim-smarthost.nix @@ -59,12 +60,6 @@ let api = { enable = mkEnableOption "krebs"; - dns = { - providers = mkOption { - type = with types; attrsOf str; - }; - }; - hosts = mkOption { type = with types; attrsOf host; default = {}; @@ -74,13 +69,6 @@ let type = with types; attrsOf user; }; - # XXX is there a better place to define search-domain? - # TODO search-domains :: listOf hostname - search-domain = mkOption { - type = types.hostname; - default = "r"; - }; - sitemap = mkOption { default = {}; type = types.attrsOf types.sitemap.entry; @@ -126,6 +114,8 @@ let w = "hosts"; }; + krebs.dns.search-domain = mkDefault "r"; + krebs.users = { krebs = { home = "/krebs"; @@ -147,7 +137,7 @@ let let aliases = longs ++ shorts; longs = filter check net.aliases; - shorts = let s = ".${cfg.search-domain}"; in + shorts = let s = ".${cfg.dns.search-domain}"; in map (removeSuffix s) (filter (hasSuffix s) longs); in optionals @@ -203,8 +193,8 @@ let let longs = net.aliases; shorts = - map (removeSuffix ".${cfg.search-domain}") - (filter (hasSuffix ".${cfg.search-domain}") + map (removeSuffix ".${cfg.dns.search-domain}") + (filter (hasSuffix ".${cfg.dns.search-domain}") longs); add-port = a: if net.ssh.port != 22 @@ -228,8 +218,8 @@ let (concatMap (host: attrValues host.nets) (mapAttrsToList (_: host: recursiveUpdate host - (optionalAttrs (hasAttr config.krebs.search-domain host.nets) { - nets."" = host.nets.${config.krebs.search-domain} // { + (optionalAttrs (hasAttr cfg.dns.search-domain host.nets) { + nets."" = host.nets.${cfg.dns.search-domain} // { aliases = [host.name]; addrs = []; }; diff --git a/krebs/3modules/dns.nix b/krebs/3modules/dns.nix new file mode 100644 index 000000000..b7e2a2cbb --- /dev/null +++ b/krebs/3modules/dns.nix @@ -0,0 +1,12 @@ +with import <stockholm/lib>; +{ + options = { + krebs.dns.providers = mkOption { + type = types.attrsOf types.str; + }; + + krebs.dns.search-domain = mkOption { + type = types.hostname; + }; + }; +} diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 62a42baf9..69e697a1d 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -72,7 +72,6 @@ with import <stockholm/lib>; krebs = { enable = true; - search-domain = "r"; build.user = config.krebs.users.lass; }; diff --git a/makefu/2configs/default.nix b/makefu/2configs/default.nix index 61cba86d9..cbfb4da1c 100644 --- a/makefu/2configs/default.nix +++ b/makefu/2configs/default.nix @@ -36,7 +36,6 @@ with import <stockholm/lib>; enable = true; dns.providers.lan = "hosts"; - search-domain = "r"; build.user = config.krebs.users.makefu; }; |