at 18.09-beta 1.7 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.hardware; 7in { 8 9 ###### interface 10 11 options = { 12 13 hardware.enableAllFirmware = mkOption { 14 default = false; 15 type = types.bool; 16 description = '' 17 Turn on this option if you want to enable all the firmware. 18 ''; 19 }; 20 21 hardware.enableRedistributableFirmware = mkOption { 22 default = false; 23 type = types.bool; 24 description = '' 25 Turn on this option if you want to enable all the firmware with a license allowing redistribution. 26 (i.e. free firmware and <literal>firmware-linux-nonfree</literal>) 27 ''; 28 }; 29 30 }; 31 32 33 ###### implementation 34 35 config = mkMerge [ 36 (mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) { 37 hardware.firmware = with pkgs; [ 38 firmwareLinuxNonfree 39 intel2200BGFirmware 40 rtl8192su-firmware 41 ] ++ optional (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) raspberrypiWirelessFirmware 42 ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [ 43 rtl8723bs-firmware 44 ]; 45 }) 46 (mkIf cfg.enableAllFirmware { 47 assertions = [{ 48 assertion = !cfg.enableAllFirmware || (config.nixpkgs.config.allowUnfree or false); 49 message = '' 50 the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files. 51 This requires nixpkgs.config.allowUnfree to be true. 52 An alternative is to use the hardware.enableRedistributableFirmware option. 53 ''; 54 }]; 55 hardware.firmware = with pkgs; [ 56 broadcom-bt-firmware 57 ]; 58 }) 59 ]; 60}