git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #86712 from rardiol/hostapd

nixos/hostapd: country selection, CRDA, logging

commitef0f57ff8ace1040fe9bc983bfe384352cbedcec authorLassulus <github@lassul.us> dateTue 5 May 2020, 19:51 (7 years ago) parent73dc3fca55b736
1 file changed+35−2
nixos/modules/services/networking/hostapd.nix+35−2
nixos/modules/services/networking/hostapd.nix+35−2
@@ -20,12 +20,14 @@ let
2020 ssid=${cfg.ssid}
2121 hw_mode=${cfg.hwMode}
2222 channel=${toString cfg.channel}
23+ ${optionalString (cfg.countryCode != null) ''country_code=${cfg.countryCode}''}
24+ ${optionalString (cfg.countryCode != null) ''ieee80211d=1''}
2325
2426 # logging (debug level)
2527 logger_syslog=-1
26− logger_syslog_level=2
28+ logger_syslog_level=${toString cfg.logLevel}
2729 logger_stdout=-1
28− logger_stdout_level=2
30+ logger_stdout_level=${toString cfg.logLevel}
2931
3032 ctrl_interface=/run/hostapd
3133 ctrl_interface_group=${cfg.group}
@@ -147,6 +149,35 @@ in
147149 '';
148150 };
149151
152+ logLevel = mkOption {
153+ default = 2;
154+ type = types.int;
155+ description = ''
156+ Levels (minimum value for logged events):
157+ 0 = verbose debugging
158+ 1 = debugging
159+ 2 = informational messages
160+ 3 = notification
161+ 4 = warning
162+ '';
163+ };
164+
165+ countryCode = mkOption {
166+ default = null;
167+ example = "US";
168+ type = with types; nullOr str;
169+ description = ''
170+ Country code (ISO/IEC 3166-1). Used to set regulatory domain.
171+ Set as needed to indicate country in which device is operating.
172+ This can limit available channels and transmit power.
173+ These two octets are used as the first two octets of the Country String
174+ (dot11CountryString).
175+ If set this enables IEEE 802.11d. This advertises the countryCode and
176+ the set of allowed channels and transmit power levels based on the
177+ regulatory limits.
178+ '';
179+ };
180+
150181 extraConfig = mkOption {
151182 default = "";
152183 example = ''
@@ -167,6 +198,8 @@ in
167198
168199 environment.systemPackages = [ pkgs.hostapd ];
169200
201+ services.udev.packages = optional (cfg.countryCode != null) [ pkgs.crda ];
202+
170203 systemd.services.hostapd =
171204 { description = "hostapd wireless AP";
172205