apu: setup dynamic dns record based on DHCP leases
This commit is contained in:
@@ -26,6 +26,11 @@ let
|
||||
default = { };
|
||||
};
|
||||
ipv6 = lib.mkEnableOption "ipv6";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "home.arpa";
|
||||
description = "Domain name to advertise via DHCP";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -96,6 +101,7 @@ let
|
||||
id,
|
||||
ipv6,
|
||||
staticLeases,
|
||||
domain,
|
||||
...
|
||||
}:
|
||||
{
|
||||
@@ -115,8 +121,17 @@ let
|
||||
dhcpServerConfig = {
|
||||
PoolOffset = 255;
|
||||
DNS = "10.${toString id}.0.1";
|
||||
EmitDNS = true;
|
||||
};
|
||||
extraConfig = lib.concatLines (lib.mapAttrsToList buildStaticLease staticLeases);
|
||||
extraConfig = lib.concatLines (
|
||||
(lib.mapAttrsToList buildStaticLease staticLeases)
|
||||
++ [
|
||||
''
|
||||
[DHCPServer]
|
||||
SendOption=15:string:${domain}
|
||||
''
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user