2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.hardware;
|
|
|
|
in {
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
(mkRenamedOptionModule [ "networking" "enableRT73Firmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(mkRenamedOptionModule [ "networking" "enableIntel3945ABGFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(mkRenamedOptionModule [ "networking" "enableIntel2100BGFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(mkRenamedOptionModule [ "networking" "enableRalinkFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
];
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
hardware.enableAllFirmware = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Turn on this option if you want to enable all the firmware.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
hardware.enableRedistributableFirmware = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Turn on this option if you want to enable all the firmware with a license allowing redistribution.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
hardware.wirelessRegulatoryDatabase = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
Load the wireless regulatory database at boot.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) {
|
|
|
|
hardware.firmware = with pkgs; [
|
2022-01-13 20:06:32 +00:00
|
|
|
linux-firmware
|
2020-04-24 23:36:52 +00:00
|
|
|
intel2200BGFirmware
|
|
|
|
rtl8192su-firmware
|
|
|
|
rt5677-firmware
|
|
|
|
rtl8723bs-firmware
|
2020-12-25 13:55:36 +00:00
|
|
|
rtl8761b-firmware
|
2021-04-05 15:23:46 +00:00
|
|
|
rtw88-firmware
|
2020-04-24 23:36:52 +00:00
|
|
|
zd1211fw
|
|
|
|
alsa-firmware
|
2020-05-15 21:57:56 +00:00
|
|
|
sof-firmware
|
2021-08-22 07:53:02 +00:00
|
|
|
libreelec-dvb-firmware
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware
|
|
|
|
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
|
|
|
|
rtl8723bs-firmware
|
2022-02-10 20:34:41 +00:00
|
|
|
] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [
|
|
|
|
rtw89-firmware
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2021-08-05 21:33:18 +00:00
|
|
|
hardware.wirelessRegulatoryDatabase = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
(mkIf cfg.enableAllFirmware {
|
|
|
|
assertions = [{
|
|
|
|
assertion = !cfg.enableAllFirmware || (config.nixpkgs.config.allowUnfree or false);
|
|
|
|
message = ''
|
|
|
|
the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files.
|
|
|
|
This requires nixpkgs.config.allowUnfree to be true.
|
|
|
|
An alternative is to use the hardware.enableRedistributableFirmware option.
|
|
|
|
'';
|
|
|
|
}];
|
|
|
|
hardware.firmware = with pkgs; [
|
|
|
|
broadcom-bt-firmware
|
|
|
|
b43Firmware_5_1_138
|
|
|
|
b43Firmware_6_30_163_46
|
|
|
|
b43FirmwareCutter
|
2022-03-05 16:20:37 +00:00
|
|
|
xow_dongle-firmware
|
2021-12-06 16:07:01 +00:00
|
|
|
] ++ optional pkgs.stdenv.hostPlatform.isx86 facetimehd-firmware;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
2021-08-05 21:33:18 +00:00
|
|
|
(mkIf cfg.wirelessRegulatoryDatabase {
|
|
|
|
hardware.firmware = [ pkgs.wireless-regdb ];
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
}
|