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