summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-21 10:32:15 +0100
committertv <tv@krebsco.de>2019-01-21 10:33:23 +0100
commitda79d23ebbc0c3fb7c579b366f29fb3744948706 (patch)
tree5f1e25928385b7588e37ad4525e4d14391818190 /krebs
parent9082adf6878b5f917efc633cba63932d94942d13 (diff)
krebs: move dns stuff to dedicated file
Diffstat (limited to 'krebs')
-rw-r--r--krebs/3modules/default.nix26
-rw-r--r--krebs/3modules/dns.nix12
2 files changed, 20 insertions, 18 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;
+ };
+ };
+}