nixpkgs/nixos/modules/hardware/all-firmware.nix

61 lines
1.6 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2013-10-30 16:37:45 +00:00
with lib;
let
cfg = config.hardware;
in {
###### 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 = false;
type = types.bool;
description = ''
Turn on this option if you want to enable all the firmware with a license allowing redistribution.
(i.e. free firmware and <literal>firmware-linux-nonfree</literal>)
'';
};
};
###### implementation
config = mkMerge [
(mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) {
hardware.firmware = with pkgs; [
firmwareLinuxNonfree
intel2200BGFirmware
rtl8192su-firmware
2018-05-25 04:03:42 +01:00
] ++ optional (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) raspberrypiWirelessFirmware
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
rtl8723bs-firmware
];
})
(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
];
})
];
}