mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 02:13:55 -05:00
hosts: move wifi networks to wifi.nix
This commit is contained in:
parent
259f3cbd17
commit
0fc3c44c4e
|
@ -4,47 +4,7 @@
|
|||
|
||||
ensureProfiles = {
|
||||
environmentFiles = [config.age.secrets.wifi.path];
|
||||
|
||||
profiles = let
|
||||
mkOpenWiFi = ssid: {
|
||||
connection.id = "${ssid}";
|
||||
connection.type = "wifi";
|
||||
ipv4.method = "auto";
|
||||
ipv6.addr-gen-mode = "default";
|
||||
ipv6.method = "auto";
|
||||
wifi.mode = "infrastructure";
|
||||
wifi.ssid = "${ssid}";
|
||||
};
|
||||
|
||||
mkWPA2WiFi = ssid: psk: (
|
||||
(mkOpenWiFi ssid)
|
||||
// {
|
||||
wifi-security.auth-alg = "open";
|
||||
wifi-security.key-mgmt = "wpa-psk";
|
||||
wifi-security.psk = "${psk}";
|
||||
}
|
||||
);
|
||||
|
||||
mkEAPWiFi = ssid: identity: pass: auth: (
|
||||
(mkOpenWiFi ssid)
|
||||
// {
|
||||
"802-1x".eap = "peap;";
|
||||
"802-1x".identity = "${identity}";
|
||||
"802-1x".password = "${pass}";
|
||||
"802-1x".phase2-auth = "${auth}";
|
||||
wifi-security.auth-alg = "open";
|
||||
wifi-security.key-mgmt = "wpa-eap";
|
||||
}
|
||||
);
|
||||
in {
|
||||
"Dustin's A54" = mkWPA2WiFi "Dustin's A54" "$DustinsA54PSK";
|
||||
"FCS-WiFi2" = mkEAPWiFi "FCS-WiFi2" "$FCSIdentity" "$FCSPassword" "mschapv2";
|
||||
"javapatron" = mkOpenWiFi "javapatron";
|
||||
"Stargate-Discovery" = mkWPA2WiFi "Stargate-Discovery" "$StargateDiscoveryPSK";
|
||||
"Taproom Public WiFi" = mkOpenWiFi "Taproom Public WiFi";
|
||||
"wallace" = mkWPA2WiFi "wallace" "$wallacePSK";
|
||||
"WeWorkWiFi" = mkEAPWiFi "WeWorkWiFi" "$WeWorkWiFiIdentity" "$WeWorkWiFiPassword" "mschapv2";
|
||||
};
|
||||
profiles = import ./wifi.nix;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
40
hosts/common/wifi.nix
Normal file
40
hosts/common/wifi.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
let
|
||||
mkOpenWiFi = ssid: {
|
||||
connection.id = "${ssid}";
|
||||
connection.type = "wifi";
|
||||
ipv4.method = "auto";
|
||||
ipv6.addr-gen-mode = "default";
|
||||
ipv6.method = "auto";
|
||||
wifi.mode = "infrastructure";
|
||||
wifi.ssid = "${ssid}";
|
||||
};
|
||||
|
||||
mkWPA2WiFi = ssid: psk: (
|
||||
(mkOpenWiFi ssid)
|
||||
// {
|
||||
wifi-security.auth-alg = "open";
|
||||
wifi-security.key-mgmt = "wpa-psk";
|
||||
wifi-security.psk = "${psk}";
|
||||
}
|
||||
);
|
||||
|
||||
mkEAPWiFi = ssid: identity: pass: auth: (
|
||||
(mkOpenWiFi ssid)
|
||||
// {
|
||||
"802-1x".eap = "peap;";
|
||||
"802-1x".identity = "${identity}";
|
||||
"802-1x".password = "${pass}";
|
||||
"802-1x".phase2-auth = "${auth}";
|
||||
wifi-security.auth-alg = "open";
|
||||
wifi-security.key-mgmt = "wpa-eap";
|
||||
}
|
||||
);
|
||||
in {
|
||||
"Dustin's A54" = mkWPA2WiFi "Dustin's A54" "$DustinsA54PSK";
|
||||
"FCS-WiFi2" = mkEAPWiFi "FCS-WiFi2" "$FCSIdentity" "$FCSPassword" "mschapv2";
|
||||
"javapatron" = mkOpenWiFi "javapatron";
|
||||
"Stargate-Discovery" = mkWPA2WiFi "Stargate-Discovery" "$StargateDiscoveryPSK";
|
||||
"Taproom Public WiFi" = mkOpenWiFi "Taproom Public WiFi";
|
||||
"wallace" = mkWPA2WiFi "wallace" "$wallacePSK";
|
||||
"WeWorkWiFi" = mkEAPWiFi "WeWorkWiFi" "$WeWorkWiFiIdentity" "$WeWorkWiFiPassword" "mschapv2";
|
||||
}
|
Loading…
Reference in a new issue