krebs.dns: allow disabling search-domain
This commit is contained in:
parent
b63d24d58e
commit
b0880d5736
@ -152,9 +152,11 @@ let
|
|||||||
let
|
let
|
||||||
longs = net.aliases;
|
longs = net.aliases;
|
||||||
shorts =
|
shorts =
|
||||||
map (removeSuffix ".${cfg.dns.search-domain}")
|
optionals
|
||||||
|
(cfg.dns.search-domain != null)
|
||||||
|
(map (removeSuffix ".${cfg.dns.search-domain}")
|
||||||
(filter (hasSuffix ".${cfg.dns.search-domain}")
|
(filter (hasSuffix ".${cfg.dns.search-domain}")
|
||||||
longs);
|
longs));
|
||||||
add-port = a:
|
add-port = a:
|
||||||
if net.ssh.port != 22
|
if net.ssh.port != 22
|
||||||
then "[${a}]:${toString net.ssh.port}"
|
then "[${a}]:${toString net.ssh.port}"
|
||||||
@ -177,7 +179,8 @@ let
|
|||||||
(concatMap (host: attrValues host.nets)
|
(concatMap (host: attrValues host.nets)
|
||||||
(mapAttrsToList
|
(mapAttrsToList
|
||||||
(_: host: recursiveUpdate host
|
(_: host: recursiveUpdate host
|
||||||
(optionalAttrs (hasAttr cfg.dns.search-domain host.nets) {
|
(optionalAttrs (cfg.dns.search-domain != null &&
|
||||||
|
hasAttr cfg.dns.search-domain host.nets) {
|
||||||
nets."" = host.nets.${cfg.dns.search-domain} // {
|
nets."" = host.nets.${cfg.dns.search-domain} // {
|
||||||
aliases = [host.name];
|
aliases = [host.name];
|
||||||
addrs = [];
|
addrs = [];
|
||||||
|
@ -6,7 +6,7 @@ with import <stockholm/lib>;
|
|||||||
};
|
};
|
||||||
|
|
||||||
krebs.dns.search-domain = mkOption {
|
krebs.dns.search-domain = mkOption {
|
||||||
type = types.hostname;
|
type = types.nullOr types.hostname;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,11 @@ in {
|
|||||||
aliases = longs ++ shorts;
|
aliases = longs ++ shorts;
|
||||||
longs = filter check net.aliases;
|
longs = filter check net.aliases;
|
||||||
shorts = let s = ".${config.krebs.dns.search-domain}"; in
|
shorts = let s = ".${config.krebs.dns.search-domain}"; in
|
||||||
map (removeSuffix s) (filter (hasSuffix s) longs);
|
optionals
|
||||||
|
(config.krebs.dns.search-domain != null)
|
||||||
|
(map (removeSuffix s)
|
||||||
|
(filter (hasSuffix s)
|
||||||
|
longs));
|
||||||
in
|
in
|
||||||
map (addr: { ${addr} = aliases; }) net.addrs)
|
map (addr: { ${addr} = aliases; }) net.addrs)
|
||||||
(attrValues host.nets))
|
(attrValues host.nets))
|
||||||
|
Loading…
Reference in New Issue
Block a user