at 22.05-pre 3.0 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.hardware; 7in { 8 9 imports = [ 10 (mkRenamedOptionModule [ "networking" "enableRT73Firmware" ] [ "hardware" "enableRedistributableFirmware" ]) 11 (mkRenamedOptionModule [ "networking" "enableIntel3945ABGFirmware" ] [ "hardware" "enableRedistributableFirmware" ]) 12 (mkRenamedOptionModule [ "networking" "enableIntel2100BGFirmware" ] [ "hardware" "enableRedistributableFirmware" ]) 13 (mkRenamedOptionModule [ "networking" "enableRalinkFirmware" ] [ "hardware" "enableRedistributableFirmware" ]) 14 (mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ]) 15 ]; 16 17 ###### interface 18 19 options = { 20 21 hardware.enableAllFirmware = mkOption { 22 default = false; 23 type = types.bool; 24 description = '' 25 Turn on this option if you want to enable all the firmware. 26 ''; 27 }; 28 29 hardware.enableRedistributableFirmware = mkOption { 30 default = false; 31 type = types.bool; 32 description = '' 33 Turn on this option if you want to enable all the firmware with a license allowing redistribution. 34 (i.e. free firmware and <literal>firmware-linux-nonfree</literal>) 35 ''; 36 }; 37 38 hardware.wirelessRegulatoryDatabase = mkOption { 39 default = false; 40 type = types.bool; 41 description = '' 42 Load the wireless regulatory database at boot. 43 ''; 44 }; 45 46 }; 47 48 49 ###### implementation 50 51 config = mkMerge [ 52 (mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) { 53 hardware.firmware = with pkgs; [ 54 firmwareLinuxNonfree 55 intel2200BGFirmware 56 rtl8192su-firmware 57 rt5677-firmware 58 rtl8723bs-firmware 59 rtl8761b-firmware 60 rtw88-firmware 61 rtw89-firmware 62 zd1211fw 63 alsa-firmware 64 sof-firmware 65 libreelec-dvb-firmware 66 ] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware 67 ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [ 68 rtl8723bs-firmware 69 ]; 70 hardware.wirelessRegulatoryDatabase = true; 71 }) 72 (mkIf cfg.enableAllFirmware { 73 assertions = [{ 74 assertion = !cfg.enableAllFirmware || (config.nixpkgs.config.allowUnfree or false); 75 message = '' 76 the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files. 77 This requires nixpkgs.config.allowUnfree to be true. 78 An alternative is to use the hardware.enableRedistributableFirmware option. 79 ''; 80 }]; 81 hardware.firmware = with pkgs; [ 82 broadcom-bt-firmware 83 b43Firmware_5_1_138 84 b43Firmware_6_30_163_46 85 b43FirmwareCutter 86 ] ++ optional pkgs.stdenv.hostPlatform.isx86 facetimehd-firmware; 87 }) 88 (mkIf cfg.wirelessRegulatoryDatabase { 89 hardware.firmware = [ pkgs.wireless-regdb ]; 90 }) 91 ]; 92}