feat: try rework
This commit is contained in:
parent
1ddbd3b8b6
commit
ecf10628c3
51 changed files with 1941 additions and 445 deletions
|
|
@ -1,7 +1,20 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
net = import ../data/network.nix;
|
||||
net = import ../config/network.nix;
|
||||
dhcpModel = import ../intermediate/dhcp.nix;
|
||||
|
||||
routerIp =
|
||||
if net ? devices && builtins.isAttrs net.devices && net.devices ? router && net.devices.router ? ip && builtins.isString net.devices.router.ip then
|
||||
net.devices.router.ip
|
||||
else
|
||||
throw "config/network.nix must define devices.router.ip as string.";
|
||||
|
||||
dnsServerIp =
|
||||
if net ? devices && builtins.isAttrs net.devices && net.devices ? self && net.devices.self ? ip && builtins.isString net.devices.self.ip then
|
||||
net.devices.self.ip
|
||||
else
|
||||
throw "config/network.nix must define devices.self.ip as string.";
|
||||
in
|
||||
{
|
||||
services.kea.dhcp4 = {
|
||||
|
|
@ -23,11 +36,11 @@ in
|
|||
option-data = [
|
||||
{
|
||||
name = "routers";
|
||||
data = net.ips.router;
|
||||
data = routerIp;
|
||||
}
|
||||
{
|
||||
name = "domain-name-servers";
|
||||
data = builtins.concatStringsSep ", " ([net.ips.pi] ++ net.fallback_dns_servers);
|
||||
data = builtins.concatStringsSep ", " ([dnsServerIp] ++ net.fallback_dns_servers);
|
||||
}
|
||||
{
|
||||
name = "domain-name";
|
||||
|
|
@ -39,7 +52,7 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
reservations = net.dhcp.reservations;
|
||||
reservations = dhcpModel.reservations;
|
||||
}];
|
||||
|
||||
valid-lifetime = net.dhcp.default_lease;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue