diff options
Diffstat (limited to 'modules/root/wifi.nix')
-rw-r--r-- | modules/root/wifi.nix | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/modules/root/wifi.nix b/modules/root/wifi.nix index 880d436..542cfd7 100644 --- a/modules/root/wifi.nix +++ b/modules/root/wifi.nix @@ -1,18 +1,4 @@ -{ 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 9; # Number of networks listed in wireless-env -in { +{ lib, config, ... }: { options = { wifi.enable = lib.mkEnableOption "enables wifi"; }; @@ -21,8 +7,12 @@ in { networking.wireless = { enable = true; # Enables wireless support via wpa_supplicant. userControlled.enable = true; - inherit networks; - inherit environmentFile; + allowAuxiliaryImperativeNetworks = true; # Networks defined in aux imperitive networks (/etc/wpa_supplicant.conf) + }; + + # Link /etc/wpa_supplicant.conf -> secret config + environment.etc."wpa_supplicant.conf" = { + source = config.sops.secrets.wpa_supplicant-conf.path; }; }; } |