2025-04-06 12:53:13 -04:00

48 lines
1.2 KiB
Nix

{ config, lib, pkgs, namespace, ... }:
let
inherit (lib) mkIf mkDefault mkEnableOption;
inherit (lib.${namespace}) mkBoolOpt enabled;
cfg = config.${namespace}.system.networking;
in
{
options.${namespace}.system.networking = {
enable = mkEnableOption "Enable Networking";
enableIWD = mkEnableOption "Enable IWD";
useDHCP = mkBoolOpt true "Use DHCP";
useNetworkd = mkBoolOpt false "Use networkd";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
mtr
tcpdump
traceroute
];
reichard.user.extraGroups = [ "network" ];
networking = {
firewall = enabled;
useDHCP = mkDefault cfg.useDHCP;
useNetworkd = cfg.useNetworkd;
} // (lib.optionalAttrs cfg.enableIWD) {
wireless.iwd = {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
};
# TODO - Network Configuration
# (lib.mkIf (config.network != null) {
# networking = {
# inherit (config.network) defaultGateway nameservers;
# interfaces.${config.network.interface}.ipv4.addresses = [{
# inherit (config.network) address;
# prefixLength = 24;
# }];
# };
# })
};
}