aboutsummaryrefslogtreecommitdiff
path: root/nixos/routers/wifi-spt.nix
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-01-23 21:23:23 +0100
committerKarel Kočí <cynerd@email.cz>2023-01-23 21:23:23 +0100
commit89a605727649bb4599af04681e40a19bf24e69a4 (patch)
tree1f8ab6de3825c5c1f88f90c9b08a1d223e47e7d0 /nixos/routers/wifi-spt.nix
parentd965ae516e238dde8f22234859b81a5a25b7f726 (diff)
downloadnixos-personal-89a605727649bb4599af04681e40a19bf24e69a4.tar.gz
nixos-personal-89a605727649bb4599af04681e40a19bf24e69a4.tar.bz2
nixos-personal-89a605727649bb4599af04681e40a19bf24e69a4.zip
nixos: improve wifi configuration
Diffstat (limited to 'nixos/routers/wifi-spt.nix')
-rw-r--r--nixos/routers/wifi-spt.nix83
1 files changed, 83 insertions, 0 deletions
diff --git a/nixos/routers/wifi-spt.nix b/nixos/routers/wifi-spt.nix
new file mode 100644
index 0000000..1cbb567
--- /dev/null
+++ b/nixos/routers/wifi-spt.nix
@@ -0,0 +1,83 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
+ cnf = config.cynerd.wifiAP.spt;
+
+ wOptions = card: channelDefault: {
+ interface = mkOption {
+ type = with types; nullOr str;
+ default = null;
+ description = "Specify interface for ${card}";
+ };
+ channel = mkOption {
+ type = types.ints.positive;
+ default = channelDefault;
+ description = "Channel to be used for ${card}";
+ };
+ };
+in {
+ options = {
+ cynerd.wifiAP.spt = {
+ enable = mkEnableOption "Enable Wi-Fi Access Point support";
+ ar9287 = wOptions "Qualcom Atheros AR9287" 7;
+ qca988x = wOptions "Qualcom Atheros QCA988x" 36;
+ };
+ };
+
+ config = mkIf cnf.enable {
+ networking.wirelessAP = {
+ enable = true;
+ environmentFile = "/run/secrets/hostapd.env";
+ interfaces =
+ (optionalAttrs (cnf.ar9287.interface != null) {
+ "${cnf.ar9287.interface}" =
+ wifiAP.qualcomAtherosAR9287 {
+ channel = cnf.ar9287.channel;
+ }
+ // {
+ bssid = "@BSSID_AR9287_0@";
+ ssid = "TurrisRules";
+ wpa = 2;
+ wpaPassphrase = "@PASS_TURRIS_RULES@";
+ bridge = "brlan";
+ bss = {
+ "${cnf.ar9287.interface}.guest" = {
+ bssid = "@BSSID_AR9287_1@";
+ ssid = "Kocovi";
+ wpa = 2;
+ wpaPassphrase = "@PASS_KOCOVI@";
+ bridge = "brguest";
+ };
+ };
+ };
+ })
+ // (optionalAttrs (cnf.qca988x.interface != null) {
+ "${cnf.qca988x.interface}" =
+ wifiAP.qualcomAtherosQCA988x {
+ channel = cnf.qca988x.channel;
+ }
+ // {
+ bssid = "@BSSID_QCA988X_0@";
+ countryCode = "CZ";
+ ssid = "TurrisRules5";
+ wpa = 2;
+ wpaPassphrase = "@PASS_TURRIS_RULES@";
+ bridge = "brlan";
+ bss = {
+ "${cnf.qca988x.interface}.guest" = {
+ bssid = "@BSSID_QCA988X_1@";
+ ssid = "Kocovi";
+ wpa = 2;
+ wpaPassphrase = "@PASS_KOCOVI@";
+ bridge = "brguest";
+ };
+ };
+ };
+ });
+ };
+ };
+}