2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.hardware;
|
|
|
|
in {
|
|
|
|
|
|
|
|
imports = [
|
2024-09-19 14:19:46 +00:00
|
|
|
(lib.mkRenamedOptionModule [ "networking" "enableRT73Firmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(lib.mkRenamedOptionModule [ "networking" "enableIntel3945ABGFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(lib.mkRenamedOptionModule [ "networking" "enableIntel2100BGFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(lib.mkRenamedOptionModule [ "networking" "enableRalinkFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
|
|
|
(lib.mkRenamedOptionModule [ "networking" "enableRTL8192cFirmware" ] [ "hardware" "enableRedistributableFirmware" ])
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
hardware.enableAllFirmware = lib.mkEnableOption "all firmware regardless of license";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
hardware.enableRedistributableFirmware = lib.mkEnableOption "firmware with a license allowing redistribution" // {
|
2022-04-27 09:35:20 +00:00
|
|
|
default = config.hardware.enableAllFirmware;
|
|
|
|
defaultText = lib.literalExpression "config.hardware.enableAllFirmware";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
hardware.wirelessRegulatoryDatabase = lib.mkEnableOption "loading the wireless regulatory database at boot" // {
|
2023-11-16 04:20:00 +00:00
|
|
|
default = cfg.enableRedistributableFirmware || cfg.enableAllFirmware;
|
2024-09-19 14:19:46 +00:00
|
|
|
defaultText = lib.literalMD "Enabled if proprietary firmware is allowed via {option}`enableRedistributableFirmware` or {option}`enableAllFirmware`.";
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) {
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2020-12-25 13:55:36 +00:00
|
|
|
rtl8761b-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
|
2024-09-19 14:19:46 +00:00
|
|
|
] ++ lib.optional pkgs.stdenv.hostPlatform.isAarch raspberrypiWirelessFirmware;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
2024-09-19 14:19:46 +00:00
|
|
|
(lib.mkIf cfg.enableAllFirmware {
|
2020-04-24 23:36:52 +00:00
|
|
|
assertions = [{
|
2023-10-09 19:29:22 +00:00
|
|
|
assertion = !cfg.enableAllFirmware || pkgs.config.allowUnfree;
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
2022-03-05 16:20:37 +00:00
|
|
|
xow_dongle-firmware
|
2024-09-19 14:19:46 +00:00
|
|
|
] ++ lib.optionals pkgs.stdenv.hostPlatform.isx86 [
|
2022-04-27 09:35:20 +00:00
|
|
|
facetimehd-calibration
|
|
|
|
facetimehd-firmware
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
2024-09-19 14:19:46 +00:00
|
|
|
(lib.mkIf cfg.wirelessRegulatoryDatabase {
|
2021-08-05 21:33:18 +00:00
|
|
|
hardware.firmware = [ pkgs.wireless-regdb ];
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
}
|