{ config, lib, pkgs, ... }: let cfg = config.os.core.network; in { options.os.core.network = { enable = lib.mkEnableOption "system-wide networking setup"; profile = lib.mkOption { type = lib.types.enum [ "client" "server" ]; default = "client"; description = "Which networking profile configuration to apply"; }; }; config = lib.mkIf cfg.enable ( lib.mkMerge [ { networking.networkmanager = { enable = true; dns = "systemd-resolved"; }; services.resolved.enable = true; } (lib.mkIf (cfg.profile == "client") { networking.networkmanager = { wifi.macAddress = "random"; wifi.backend = "iwd"; ethernet.macAddress = "random"; }; systemd.services."NetworkManager-wait-online".enable = false; environment.systemPackages = [ pkgs.impala ]; }) (lib.mkIf (cfg.profile == "server") { networking.networkmanager = { wifi.macAddress = "keep"; ethernet.macAddress = "keep"; }; }) ] ); }