{ config, lib, ... }: let cfg = config.os.srv.kea; in { options.os.srv.kea.enable = lib.mkEnableOption "enables kea dhcp server"; config = lib.mkIf cfg.enable { services.kea.dhcp4 = { enable = true; settings = { interfaces-config = { # To be used in a VM interfaces = [ "eth0" ]; dhcp-socket-type = "udp"; }; lease-database = { type = "memfile"; persist = true; name = "/var/lib/kea/dhcp4.leases"; }; subnet4 = [ { id = 1; subnet = "10.1.0.0/24"; pools = [ { pool = "10.1.0.50 - 10.1.0.250"; } ]; option-data = [ { name = "routers"; data = "10.1.0.1"; } { name = "domain-name-servers"; data = "10.0.0.3"; } ]; } { id = 2; subnet = "10.2.0.0/24"; pools = [ { pool = "10.2.0.50 - 10.2.0.250"; } ]; option-data = [ { name = "routers"; data = "10.2.0.1"; } { name = "domain-name-servers"; data = "10.0.0.3"; } ]; } ]; }; }; }; }