mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-19 15:14:56 +01:00
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
97 lines
3.1 KiB
Nix
97 lines
3.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
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 = {
|
|
|
|
hardware.enableAllFirmware = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = lib.mdDoc ''
|
|
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 = lib.mdDoc ''
|
|
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 = lib.mdDoc ''
|
|
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
|
|
sof-firmware
|
|
libreelec-dvb-firmware
|
|
] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware
|
|
++ 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 = [{
|
|
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
|
|
xow_dongle-firmware
|
|
] ++ optionals pkgs.stdenv.hostPlatform.isx86 [
|
|
facetimehd-calibration
|
|
facetimehd-firmware
|
|
];
|
|
})
|
|
(mkIf cfg.wirelessRegulatoryDatabase {
|
|
hardware.firmware = [ pkgs.wireless-regdb ];
|
|
})
|
|
];
|
|
}
|