summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorGuillaume Girol <symphorien+git@xlumurb.eu>2021-05-02 12:00:00 +0000
committerGuillaume Girol <symphorien+git@xlumurb.eu>2021-05-23 19:49:05 +0200
commit8fe0143d88e87e529c3d143ae2fb589ce651dcb6 (patch)
treebbd15e7668ef9bd9549486c61cd727157e72cd92 /nixos
parent900115a4f7fdd9189e7803ca781a65be663f2c89 (diff)
downloadnixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar.gz
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar.bz2
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar.lz
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar.xz
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.tar.zst
nixpkgs-8fe0143d88e87e529c3d143ae2fb589ce651dcb6.zip
nixos: add option to load wireless regulatory database as firmware
use it when networkmanager or wpa_supplicant is enabled.

fixes #57053
fixes "Direct firmware load for regulatory.db failed with error -2"
in dmesg

Note that all kernels on unstable are newer that 4.15, which is required
for this to work.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/all-firmware.nix12
-rw-r--r--nixos/modules/services/networking/networkmanager.nix3
-rw-r--r--nixos/modules/services/networking/wpa_supplicant.nix3
3 files changed, 16 insertions, 2 deletions
diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix
index 3e88a4c20ad..524dae57010 100644
--- a/nixos/modules/hardware/all-firmware.nix
+++ b/nixos/modules/hardware/all-firmware.nix
@@ -35,6 +35,14 @@ in {
       '';
     };
 
+    hardware.wirelessRegulatoryDatabase = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Load the wireless regulatory database at boot.
+      '';
+    };
+
   };
 
 
@@ -58,6 +66,7 @@ in {
         ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
         rtl8723bs-firmware
       ];
+      hardware.wirelessRegulatoryDatabase = true;
     })
     (mkIf cfg.enableAllFirmware {
       assertions = [{
@@ -75,5 +84,8 @@ in {
         b43FirmwareCutter
       ] ++ optional (pkgs.stdenv.hostPlatform.isi686 || pkgs.stdenv.hostPlatform.isx86_64) facetimehd-firmware;
     })
+    (mkIf cfg.wirelessRegulatoryDatabase {
+      hardware.firmware = [ pkgs.wireless-regdb ];
+    })
   ];
 }
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 135f29be58c..8a12a5eec41 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -6,7 +6,6 @@ let
   cfg = config.networking.networkmanager;
 
   basePackages = with pkgs; [
-    crda
     modemmanager
     networkmanager
     networkmanager-fortisslvpn
@@ -367,6 +366,8 @@ in {
       }
     ];
 
+    hardware.wirelessRegulatoryDatabase = true;
+
     environment.etc = with pkgs; {
       "NetworkManager/NetworkManager.conf".source = configFile;
 
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 8a0685c3d96..f592cc2d207 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -228,7 +228,8 @@ in {
     environment.systemPackages = [ package ];
 
     services.dbus.packages = [ package ];
-    services.udev.packages = [ pkgs.crda ];
+
+    hardware.wirelessRegulatoryDatabase = true;
 
     # FIXME: start a separate wpa_supplicant instance per interface.
     systemd.services.wpa_supplicant = let