{ pkgs, config, lib, ... }: with lib; let cfg = config.eboskma.networking; in { options.eboskma.networking = { enable = mkEnableOption "activate networing settings"; dhcpInterfaces = mkOption { description = "list of interfaces to enable DHCP on"; type = types.listOf types.nonEmptyStr; }; }; config = mkIf (cfg.enable) { networking = { networkmanager.enable = true; interfaces = listToAttrs (builtins.map (iface: { name = iface; value = { useDHCP = true; }; }) cfg.dhcpInterfaces); }; users.extraUsers.${config.eboskma.var.mainUser}.extraGroups = [ "networkmanager" ]; }; }