aboutsummaryrefslogtreecommitdiff
path: root/nixos/routers/wifi-adm.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/routers/wifi-adm.nix')
-rw-r--r--nixos/routers/wifi-adm.nix97
1 files changed, 97 insertions, 0 deletions
diff --git a/nixos/routers/wifi-adm.nix b/nixos/routers/wifi-adm.nix
new file mode 100644
index 0000000..df334e5
--- /dev/null
+++ b/nixos/routers/wifi-adm.nix
@@ -0,0 +1,97 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
+ cnf = config.cynerd.wifiAP.adm;
+
+ 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.adm = {
+ 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_W24_0@";
+ ssid = "TurrisAdamkovi";
+ wpa = 2;
+ wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@";
+ bridge = "brlan";
+ bss = {
+ "${cnf.ar9287.interface}.nela" = {
+ bssid = "@BSSID_W24_1@";
+ ssid = "Nela";
+ wpa = 2;
+ wpaPassphrase = "@PASS_NELA@";
+ bridge = "brguest";
+ };
+ "${cnf.ar9287.interface}.milan" = {
+ bssid = "@BSSID_W24_2@";
+ ssid = "MILAN-AC";
+ wpa = 2;
+ wpaPassphrase = "@PASS_MILAN_AC@";
+ bridge = "brguest";
+ };
+ };
+ };
+ })
+ // (optionalAttrs (cnf.qca988x.interface != null) {
+ "${cnf.qca988x.interface}" =
+ wifiAP.qualcomAtherosQCA988x {
+ channel = cnf.qca988x.channel;
+ }
+ // {
+ bssid = "@BSSID_W5_0@";
+ countryCode = "CZ";
+ ssid = "TurrisAdamkovi5";
+ wpa = 2;
+ wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@";
+ bridge = "brlan";
+ bss = {
+ "${cnf.qca988x.interface}.nela" = {
+ bssid = "@BSSID_W5_1@";
+ ssid = "Nela5";
+ wpa = 2;
+ wpaPassphrase = "@PASS_NELA@";
+ bridge = "brguest";
+ };
+ "${cnf.qca988x.interface}.milan" = {
+ bssid = "@BSSID_W5_2@";
+ ssid = "MILAN-AC";
+ wpa = 2;
+ wpaPassphrase = "@PASS_MILAN_AC@";
+ bridge = "brguest";
+ };
+ };
+ };
+ });
+ };
+ };
+}