{ config, lib, pkgs, namespace, ... }: let inherit (lib) mkIf mkForce; inherit (lib.${namespace}) mkBoolOpt; cfg = config.${namespace}.system.networking; in { options.${namespace}.system.networking = { enable = lib.mkEnableOption "networking support"; enableIWD = mkBoolOpt false "enable iwd"; }; config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ mtr tcpdump traceroute ]; reichard.user.extraGroups = [ "network" ]; networking = { firewall.enable = true; usePredictableInterfaceNames = mkForce true; } // (lib.optionalAttrs cfg.enableIWD) { wireless.iwd = { enable = true; settings.General.EnableNetworkConfiguration = true; }; }; }; }