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