options.nix: move domainName

This commit is contained in:
Astro 2021-04-02 03:09:45 +02:00
parent 5023f0a2df
commit b5210fa37d
3 changed files with 7 additions and 7 deletions

View File

@ -42,8 +42,8 @@ in
then dhcpData.fixed-hosts then dhcpData.fixed-hosts
else {}; else {};
router = dhcpData.host-opts.routers; router = dhcpData.host-opts.routers;
domainName = dhcpData.string-opts.domain-name;
}; };
domainName = dhcpData.string-opts.domain-name;
}) pillar.dhcp) }) pillar.dhcp)
{ core.ospf.secret = pillar.ospf.secret; } { core.ospf.secret = pillar.ospf.secret; }
] ++ ( ] ++ (

View File

@ -27,10 +27,6 @@ let
description = "Gateway"; description = "Gateway";
type = types.str; type = types.str;
}; };
domainName = mkOption {
description = "Domain name option";
type = types.str;
};
fixed-hosts = mkOption { fixed-hosts = mkOption {
type = with types; attrsOf str; type = with types; attrsOf str;
default = {}; default = {};
@ -94,6 +90,10 @@ let
type = with types; nullOr (submodule { options = dhcpOpts; }); type = with types; nullOr (submodule { options = dhcpOpts; });
default = null; default = null;
}; };
domainName = mkOption {
description = "Domain name option";
type = types.str;
};
}; };
}; };
upstreamOpts = { upstreamOpts = {

View File

@ -18,13 +18,13 @@ in
extraConfig = '' extraConfig = ''
${builtins.concatStringsSep "\n" ( ${builtins.concatStringsSep "\n" (
builtins.attrValues ( builtins.attrValues (
builtins.mapAttrs (net: { dhcp, subnet4Net, subnet4Len, ...}: builtins.mapAttrs (net: { dhcp, subnet4Net, subnet4Len, domainName, ...}:
'' ''
group { group {
default-lease-time ${toString dhcp.time}; default-lease-time ${toString dhcp.time};
max-lease-time ${toString dhcp.max-time}; max-lease-time ${toString dhcp.max-time};
option routers ${config.site.net.${net}.hosts4.${builtins.replaceStrings [".${net}"] [""] dhcp.router}}; option routers ${config.site.net.${net}.hosts4.${builtins.replaceStrings [".${net}"] [""] dhcp.router}};
option domain-name "${dhcp.domainName}"; option domain-name "${domainName}";
option domain-name-servers 172.20.73.8, 9.9.9.9; option domain-name-servers 172.20.73.8, 9.9.9.9;
subnet ${subnet4Net} netmask ${lib.netmasks.${toString subnet4Len}} { subnet ${subnet4Net} netmask ${lib.netmasks.${toString subnet4Len}} {