From 5926168b3f59a50e2759312cea643b92374e5b64 Mon Sep 17 00:00:00 2001 From: Toast Date: Sun, 14 Apr 2024 17:24:39 +0200 Subject: [PATCH] Desktop/NetworkManager: add wifi networks --- roles/desktop/services/networkmanager.nix | 46 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/roles/desktop/services/networkmanager.nix b/roles/desktop/services/networkmanager.nix index d56c81b..acf5834 100644 --- a/roles/desktop/services/networkmanager.nix +++ b/roles/desktop/services/networkmanager.nix @@ -1,11 +1,55 @@ -{config, ...}: let +{ + config, + flakeSelf, + ... +}: let tailscaleName = config.services.tailscale.interfaceName; in { + age.secrets = { + wifiPasswords.file = "${flakeSelf.inputs.secrets}/wifi-passwords.age"; + }; networking.networkmanager = { enable = true; unmanaged = [ "interface-name:${tailscaleName}" ]; wifi.macAddress = "random"; + ensureProfiles = { + environmentFiles = [config.age.secrets.wifiPasswords.path]; + profiles = { + "4g-modem" = { + connection = { + id = "4G Modem"; + type = "wifi"; + }; + ipv4.method = "auto"; + wifi = { + mode = "infrastructure"; + ssid = "TP-Link_CCB4"; + }; + wifi-security = { + auth-alg = "open"; + key-mgmt = "wpa-psk"; + psk = "$MODEM"; + }; + }; + phone = { + connection = { + id = "Phone"; + type = "wifi"; + }; + ipv4.method = "auto"; + wifi = { + mode = "infrastructure"; + ssid = "Redmi Note 10 Pro_5197"; + }; + wifi-security = { + auth-alg = "open"; + key-mgmt = "sae"; + psk = "$PHONE"; + }; + }; + }; + }; }; }