diff options
author | Tim Keller <tjkeller.xyz> | 2024-10-20 20:17:28 -0500 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-10-20 20:17:28 -0500 |
commit | da8d6b77894dbf965fe77fd824512b6f160f906d (patch) | |
tree | 25cbc079dd89150d78eda20baf8d9793da12b352 /modules/root/wifi.nix | |
parent | 0b31d1d5ea46087a13c67889d427208f6612f01a (diff) | |
download | nixos-da8d6b77894dbf965fe77fd824512b6f160f906d.tar.xz nixos-da8d6b77894dbf965fe77fd824512b6f160f906d.zip |
add age and sops pkgs. reluctantly add sops nix for managing secrets. change wifi config to use wpa supplicant and configure with secrets. wpa_gui installed.
Diffstat (limited to 'modules/root/wifi.nix')
-rw-r--r-- | modules/root/wifi.nix | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/root/wifi.nix b/modules/root/wifi.nix index 54f9089..6de8598 100644 --- a/modules/root/wifi.nix +++ b/modules/root/wifi.nix @@ -1,10 +1,28 @@ -{ pkgs, lib, config, ... }: { +{ pkgs, lib, config, ... }: +let + mkNetworksFromEnvironmentFile = n: builtins.listToAttrs ( + map (i: { + name = "@SSID_${toString i}@"; + value = { + psk = "@PSK_${toString i}@"; + priority = n - i; + }; + }) (lib.lists.range 1 n) + ); + environmentFile = config.sops.secrets.wireless-env.path; + #networks = mkNetworksFromEnvironmentFile ((builtins.length (lib.strings.splitString "\n" (builtins.readFile environmentFile))) / 2); + networks = mkNetworksFromEnvironmentFile 10; # Number of networks listed in wireless-env +in { options = { wifi.enable = lib.mkEnableOption "enables wifi"; }; config = lib.mkIf config.wifi.enable { - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.wireless = { + enable = true; # Enables wireless support via wpa_supplicant. + userControlled.enable = true; + inherit networks; + inherit environmentFile; + }; }; } |