`services.kea.enable' does not exist?

G’day,

I hope you are doing well.

I’ve been using flakes for a long time now and have never really had a problem.

I tried to use kea last night, and I’m getting some weird thing about “`services.kea.enable’ does not exist?”

Exact error is:

error:
       … while calling the 'seq' builtin
         at /nix/store/1zw47fx5h4x65n914j4b9iz0j3v17aw0-source/lib/modules.nix:359:18:
          358|         options = checked options;
          359|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          360|         _module = checked (config._module);

       … while calling the 'throw' builtin
         at /nix/store/1zw47fx5h4x65n914j4b9iz0j3v17aw0-source/lib/modules.nix:331:13:
          330|           else
          331|             throw baseMsg
             |             ^
          332|         else

       error: The option `services.kea.enable' does not exist. Definition values:
       - In `/nix/store/f5lap55kd7cx8kzwdxpdqj2pydqs4irf-source/desktop/l2/hostapd-multi.nix': true

[das@l2:~/nixos/desktop/l2]$

The flake is setup like this:

flake.nix

#
# l2/flake.nix
#
{
  description = "l2 Flake";

  # https://nix.dev/manual/nix/2.24/command-ref/new-cli/nix3-flake.html#flake-inputs
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    # https://nixos-and-flakes.thiscute.world/nixos-with-flakes/start-using-home-manager
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, home-manager, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config = {
          allowUnfree = true;
        };
      };
      lib = nixpkgs.lib;
    in {
    nixosConfigurations = {
      l2 = lib.nixosSystem rec {
        inherit system;
        modules = [
          ./configuration.nix
          home-manager.nixosModules.home-manager
          {
            home-manager.useUserPackages = true;
            home-manager.users.das = { config, pkgs, ... }: {
              imports = [ ./home.nix ];
            };
          }
        ];
      };
    };
  };
}

The flake.lock was updated 1749160002

**GMT**: Thursday, June 5, 2025 9:46:42 PM
**Relative**: 19 days ago

flake.lock

[das@l2:~/nixos/desktop/l2]$ cat flake.lock
{
  "nodes": {
    "home-manager": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1749160002,
        "narHash": "sha256-IM3xKjsKxhu7Y1WdgTltrLKiOJS8nW7D4SUDEMNr7CI=",
        "owner": "nix-community",
        "repo": "home-manager",
        "rev": "68cc9eeb3875ae9682c04629f20738e1e79d72aa",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "home-manager",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1748929857,
        "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "home-manager": "home-manager",
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

Then configuration.nix imports the nix config with the kea service definition:

./configuration.nix

{
  inputs,
  config,
  pkgs,
  lib,
  ...
}:

{
  # https://nixos.wiki/wiki/NixOS_modules
  # https://nixos-and-flakes.thiscute.world/nixos-with-flakes/start-using-home-manager
  imports =
    [
      ./hardware-configuration.nix
      #./hardware-graphics.nix
      ./sysctl.nix
      #./wireless_desktop.nix
      ./locale.nix
      ./hosts.nix
      ./firewall.nix
      #./systemdSystem.nix
      ./systemPackages.nix
      # home manager is imported in the flake
      #./home.nix
      ./nodeExporter.nix
      ./prometheus.nix
      ./grafana.nix
      # clickhouse
      #./docker-compose.nix
      ./docker-daemon.nix
      #./smokeping.nix
      #./distributed-builds.nix
      #./hyprland.nix
      #./hostapd.nix
      ./hostapd-multi.nix
    ];
...

And finally, the actual ./hostapd-multi.nix. ( I’m trying to setup a NixOS based access point with multiple NICs.).

#
# hostapd-multi.nix
#

{ config, lib, pkgs, ... }:

let
  radioIfaces = {
    # non-DFS channels
    wlp35s0 = 36;
    wlp65s0 = 40;
    wlp66s0 = 44;
    wlp97s0 = 48;
  };

  commonSettings = {
    bridge = "br0";
    ieee80211w = 2;

    # WMM tuning
    wmm_ac_be_aifs = 1;
    wmm_ac_be_cwmin = 4;
    wmm_ac_be_cwmax = 4;
    wmm_ac_be_txop_limit = 32;
    wmm_ac_be_acm = 0;
  };

  commonAuth = {
    mode = "wpa3-sae";
    saePasswords = [{ password = "strongpassword"; }];
  };

  genRadio = iface: channel: {
    countryCode = "US";
    band = "5g";
    channel = channel;

    networks.${iface} = {
      ssid = "myssid";
      authentication = commonAuth;
      settings = commonSettings;
    };
  };

in {
  services.hostapd.enable = true;
  services.hostapd.radios = lib.genAttrs (builtins.attrNames radioIfaces)
    (iface: genRadio iface radioIfaces.${iface});

  services.kea = {
    enable = true;
    dhcp4 = {
      enable = true;
      interfaces = [ "br0" ];
      settings = {
        valid-lifetime = 3600;
        subnet4 = [
          {
            subnet = "192.168.1.0/24";
            pools = [{ pool = "192.168.1.100 - 192.168.1.199"; }];
            option-data = [
              { name = "routers"; data = "192.168.1.1"; }
              { name = "domain-name-servers"; data = "192.168.1.1"; }
            ];
          }
        ];
      };
    };
  };

  # services.dnsmasq = {
  #   enable = true;
  #   resolveLocalQueries = false;

  #   settings = {
  #     port = 0; # disable dns
  #     interface = "br0";
  #     bind-interfaces = true;

  #     dhcp-range = "192.168.1.100,192.168.1.199,12h";
  #     dhcp-option = [
  #       "option:router,192.168.1.1"
  #       "option:dns-server,192.168.1.1"
  #     ];
  #   };
  # };

  # PowerDNS Recursor
  services.pdns-recursor = {
    enable = true;
    dns.address = [ "127.0.0.1" "::1" "192.168.1.1" "fd00::1" ];
    dns.allowFrom = [ "127.0.0.1/32" "::1/128" "192.168.1.0/24" "fd00::/64" ];
    yaml-settings = {
      recursor = {
        serve_rfc1918 = true;
      };
    };
  };

  # # IPv6 SLAAC via radvd
  # services.radvd = {
  #   enable = true;
  #   config = ''
  #     interface br0 {
  #       AdvSendAdvert on;
  #       prefix fd00::/64 {
  #         AdvOnLink on;
  #         AdvAutonomous on;
  #       };
  #       RDNSS fd00::1 {
  #         AdvRDNSSLifetime 600;
  #       };
  #     };
  #   '';
  # };

  # Networking setup
  networking = {
    networkmanager.enable = false;
    useDHCP = false;

    bridges.br0.interfaces = [ ];

    interfaces.br0 = {
      ipv4.addresses = [{
        address = "192.168.1.1";
        prefixLength = 24;
      }];
      ipv6.addresses = [{
        address = "fd00::1";
        prefixLength = 64;
      }];
    };

    interfaces.enp1s0.useDHCP = true;

    nat = {
      enable = true;
      externalInterface = "enp1s0";
      internalInterfaces = [ "br0" ];
    };
  };

  # Disable conflicting resolvers and provide local one
  services.resolved.enable = false;
  networking.nameservers = [ "127.0.0.1" "::1" ];

  environment.etc."resolv.conf".text = ''
    # dnsmasq
    nameserver 127.0.0.1
    nameserver ::1
    # emergency cloudflare
    nameserver 1.1.1.1
    nameserver 2606:4700:4700::1111
  '';
}

# end

I tried to switch to dhcpd, but apparently that’s hard blocked these days. So that’s kinda weird, nix knows not to allow dhcpd, but then also doesn’t know about kea? Curious.

… Posting a lot, cos I find it helps me a lot when I can see other people’s nix configs :slight_smile:

Thanks in advance,
Dave

It doesn’t exist, what made you think it does?

https://search.nixos.org/options?channel=25.05&from=0&size=50&sort=relevance&type=packages&query=kea.enable

There’s other options under services.kea, perhaps look at those.

Thanks @waffle8946 ! :pray:

For the history here’s the working kea dhcp4 config

  # systemctl status kea-dhcp4-server.service
  services.kea = {
    dhcp4 = {
      enable = true;
      settings = {
        valid-lifetime = 3600;
        renew-timer = 900;
        rebind-timer = 1800;
        interfaces-config.interfaces = [ "br0" ];
        lease-database = {
          type = "memfile";
          persist = true;
          name = "/var/lib/kea/dhcp4.leases";
        };
        subnet4 = [
          {
            id = 1;
            subnet = "192.168.1.0/24";
            pools = [{ pool = "192.168.1.100 - 192.168.1.200"; }];
            option-data = [
              { name = "routers"; data = "192.168.1.1"; }
              { name = "domain-name-servers"; data = "192.168.1.1"; }
            ];
          }
        ];
      };
    };
  };
  services.prometheus.exporters.kea = {
    enable = true;
    openFirewall = true;
    #port = 9547; # default port ( https://mynixos.com/nixpkgs/option/services.prometheus.exporters.kea.port )
    targets = [ "/run/kea/kea-dhcp4.socket" ];
  };
1 Like