3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/hardware/all-firmware.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
3.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2013-10-30 16:37:45 +00:00
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 = {
2013-10-30 16:37:45 +00:00
hardware.enableAllFirmware = mkOption {
default = false;
2013-10-30 16:37:45 +00:00
type = types.bool;
description = ''
Turn on this option if you want to enable all the firmware.
'';
};
hardware.enableRedistributableFirmware = mkOption {
default = config.hardware.enableAllFirmware;
defaultText = lib.literalExpression "config.hardware.enableAllFirmware";
type = types.bool;
description = ''
Turn on this option if you want to enable all the firmware with a license allowing redistribution.
'';
};
hardware.wirelessRegulatoryDatabase = mkOption {
default = false;
type = types.bool;
description = ''
Load the wireless regulatory database at boot.
'';
};
};
###### implementation
config = mkMerge [
(mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) {
hardware.firmware = with pkgs; [
linux-firmware
intel2200BGFirmware
rtl8192su-firmware
rt5677-firmware
rtl8723bs-firmware
rtl8761b-firmware
rtw88-firmware
zd1211fw
alsa-firmware
2020-04-28 06:25:38 +01:00
sof-firmware
libreelec-dvb-firmware
] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware
2018-05-25 04:03:42 +01:00
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
rtl8723bs-firmware
] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [
rtw89-firmware
];
hardware.wirelessRegulatoryDatabase = true;
})
(mkIf cfg.enableAllFirmware {
assertions = [{
2022-05-02 13:49:04 +01:00
assertion = !cfg.enableAllFirmware || config.nixpkgs.config.allowUnfree;
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-02-19 22:21:19 +00:00
xow_dongle-firmware
] ++ optionals pkgs.stdenv.hostPlatform.isx86 [
facetimehd-calibration
facetimehd-firmware
];
})
(mkIf cfg.wirelessRegulatoryDatabase {
hardware.firmware = [ pkgs.wireless-regdb ];
})
];
}