2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-10-30 17:37:45 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2012-01-12 18:17:01 +01:00
|
|
|
|
2017-05-08 09:50:03 +02:00
|
|
|
let
|
|
|
|
cfg = config.hardware;
|
|
|
|
in {
|
2012-01-12 18:17:01 +01:00
|
|
|
|
2019-12-10 02:51:19 +01:00
|
|
|
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" ])
|
|
|
|
];
|
|
|
|
|
2012-01-12 18:17:01 +01:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2023-10-21 17:30:36 +02:00
|
|
|
hardware.enableAllFirmware = mkEnableOption "all firmware regardless of license";
|
2017-05-08 09:50:03 +02:00
|
|
|
|
2023-10-21 17:30:36 +02:00
|
|
|
hardware.enableRedistributableFirmware = mkEnableOption "firmware with a license allowing redistribution" // {
|
2022-04-28 10:30:04 +02:00
|
|
|
default = config.hardware.enableAllFirmware;
|
|
|
|
defaultText = lib.literalExpression "config.hardware.enableAllFirmware";
|
2012-01-12 18:17:01 +01:00
|
|
|
};
|
|
|
|
|
2023-10-21 17:30:36 +02:00
|
|
|
hardware.wirelessRegulatoryDatabase = mkEnableOption "loading the wireless regulatory database at boot" // {
|
|
|
|
default = cfg.enableRedistributableFirmware || cfg.enableAllFirmware;
|
|
|
|
defaultText = literalMD "Enabled if proprietary firmware is allowed via {option}`enableRedistributableFirmware` or {option}`enableAllFirmware`.";
|
2021-05-02 14:00:00 +02:00
|
|
|
};
|
|
|
|
|
2012-01-12 18:17:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2017-05-08 09:50:03 +02:00
|
|
|
config = mkMerge [
|
2017-05-09 21:10:41 +02:00
|
|
|
(mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) {
|
2017-05-08 09:50:03 +02:00
|
|
|
hardware.firmware = with pkgs; [
|
2022-01-09 17:36:20 +01:00
|
|
|
linux-firmware
|
2017-05-08 09:50:03 +02:00
|
|
|
intel2200BGFirmware
|
|
|
|
rtl8192su-firmware
|
2019-03-28 23:59:57 +01:00
|
|
|
rt5677-firmware
|
2020-12-20 16:25:55 +01:00
|
|
|
rtl8761b-firmware
|
2021-03-31 10:14:18 +02:00
|
|
|
rtw88-firmware
|
2019-03-28 23:59:57 +01:00
|
|
|
zd1211fw
|
|
|
|
alsa-firmware
|
2020-04-28 07:25:38 +02:00
|
|
|
sof-firmware
|
2021-08-21 09:17:13 +02:00
|
|
|
libreelec-dvb-firmware
|
2023-12-05 23:29:21 +01:00
|
|
|
] ++ optional pkgs.stdenv.hostPlatform.isAarch raspberrypiWirelessFirmware;
|
2017-05-08 09:50:03 +02:00
|
|
|
})
|
|
|
|
(mkIf cfg.enableAllFirmware {
|
|
|
|
assertions = [{
|
2023-10-01 19:48:40 +02:00
|
|
|
assertion = !cfg.enableAllFirmware || pkgs.config.allowUnfree;
|
2017-05-08 09:50:03 +02:00
|
|
|
message = ''
|
|
|
|
the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files.
|
|
|
|
This requires nixpkgs.config.allowUnfree to be true.
|
2017-05-09 21:10:41 +02:00
|
|
|
An alternative is to use the hardware.enableRedistributableFirmware option.
|
2017-05-08 09:50:03 +02:00
|
|
|
'';
|
|
|
|
}];
|
|
|
|
hardware.firmware = with pkgs; [
|
|
|
|
broadcom-bt-firmware
|
2019-03-28 23:59:57 +01:00
|
|
|
b43Firmware_5_1_138
|
|
|
|
b43Firmware_6_30_163_46
|
2022-02-19 23:21:19 +01:00
|
|
|
xow_dongle-firmware
|
2022-03-15 01:42:49 +01:00
|
|
|
] ++ optionals pkgs.stdenv.hostPlatform.isx86 [
|
|
|
|
facetimehd-calibration
|
|
|
|
facetimehd-firmware
|
|
|
|
];
|
2017-05-08 09:50:03 +02:00
|
|
|
})
|
2021-05-02 14:00:00 +02:00
|
|
|
(mkIf cfg.wirelessRegulatoryDatabase {
|
|
|
|
hardware.firmware = [ pkgs.wireless-regdb ];
|
|
|
|
})
|
2017-05-08 09:50:03 +02:00
|
|
|
];
|
2012-01-12 18:17:01 +01:00
|
|
|
}
|