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
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2013-10-30 17:37:45 +01:00
|
|
|
hardware.enableAllFirmware = mkOption {
|
2012-01-12 18:17:01 +01:00
|
|
|
default = false;
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2012-01-12 18:17:01 +01:00
|
|
|
description = ''
|
2017-05-08 09:50:03 +02:00
|
|
|
Turn on this option if you want to enable all the firmware.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2017-05-09 21:10:41 +02:00
|
|
|
hardware.enableRedistributableFirmware = mkOption {
|
2017-05-08 09:50:03 +02:00
|
|
|
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>)
|
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; [
|
|
|
|
firmwareLinuxNonfree
|
|
|
|
intel2200BGFirmware
|
|
|
|
rtl8723bs-firmware
|
|
|
|
rtl8192su-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.
|
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
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
2012-01-12 18:17:01 +01:00
|
|
|
}
|