From 04b5014f7ab662a0b8ef1e67be89597721946c44 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 29 Jun 2024 15:39:31 -0400 Subject: [PATCH] base/networking: add mkEAPWiFi function helper --- nixosModules/base/networking/default.nix | 54 ++++++++++++++---------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/nixosModules/base/networking/default.nix b/nixosModules/base/networking/default.nix index ddea4886..f9328aed 100644 --- a/nixosModules/base/networking/default.nix +++ b/nixosModules/base/networking/default.nix @@ -22,9 +22,7 @@ type = "wifi"; }; - ipv4 = { - method = "auto"; - }; + ipv4.method = "auto"; ipv6 = { addr-gen-mode = "default"; @@ -43,9 +41,7 @@ type = "wifi"; }; - ipv4 = { - method = "auto"; - }; + ipv4.method = "auto"; ipv6 = { addr-gen-mode = "default"; @@ -63,29 +59,41 @@ psk = "${psk}"; }; }; + + mkEAPWiFi = ssid: identity: pass: auth: { + "802-1x" = { + eap = "PEAP"; + identity = "${identity}"; + password = "${pass}"; + phase2-auth = "${auth}"; + }; + + connection = { + id = "${ssid}"; + type = "wifi"; + }; + + ipv4.method = "auto"; + + ipv6 = { + addr-gen-mode = "default"; + method = "auto"; + }; + + wifi = { + mode = "infrastructure"; + ssid = "${ssid}"; + }; + + wifi-security.key-mgmt = "wpa-eap"; + }; in { "Dustin's A54" = mkWPAWiFi "Dustin's A54" "$DustinsA54PSK"; "javapatron" = mkOpenWiFi "javapatron"; "Stargate-Discovery" = mkWPAWiFi "Stargate-Discovery" "$StargateDiscoveryPSK"; "Taproom Public WiFi" = mkOpenWiFi "Taproom Public WiFi"; "wallace" = mkWPAWiFi "wallace" "$wallacePSK"; - - WeWorkWiFi = { - "802-1x" = { - eap = "peap;"; - identity = "$WeWorkWiFiIdentity"; - password = "$WeWorkWiFiPassword"; - phase2-auth = "mschapv2"; - }; - - connection = { - id = "WeWorkWiFi"; - type = "wifi"; - }; - - wifi-security.key-mgmt = "wpa-eap"; - wifi.ssid = "WeWorkWiFi"; - }; + "WeWorkWiFi" = mkEAPWiFi "WeWorkWiFi" "$WeWorkWiFiIdentity" "$WeWorkWiFiPassword" "mschapv2"; }; }; };