Skip to content

Commit dfd7b67

Browse files
authored
nixos: add option hardware.enableAllHardware (#364479)
2 parents 3849e83 + 4e77d44 commit dfd7b67

File tree

6 files changed

+184
-118
lines changed

6 files changed

+184
-118
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# This module enables all hardware supported by NixOS: i.e., all
2+
# firmware is included, and all devices from which one may boot are
3+
# enabled in the initrd. Its primary use is in the NixOS installation
4+
# CDs.
5+
6+
{
7+
config,
8+
lib,
9+
pkgs,
10+
...
11+
}:
12+
let
13+
platform = pkgs.stdenv.hostPlatform;
14+
in
15+
{
16+
17+
options = {
18+
hardware.enableAllHardware = lib.mkEnableOption "Enable support for most hardware";
19+
};
20+
21+
config = lib.mkIf config.hardware.enableAllHardware {
22+
23+
# The initrd has to contain any module that might be necessary for
24+
# supporting the most important parts of HW like drives.
25+
boot.initrd.availableKernelModules =
26+
[
27+
# SATA/PATA support.
28+
"ahci"
29+
30+
"ata_piix"
31+
32+
"sata_inic162x"
33+
"sata_nv"
34+
"sata_promise"
35+
"sata_qstor"
36+
"sata_sil"
37+
"sata_sil24"
38+
"sata_sis"
39+
"sata_svw"
40+
"sata_sx4"
41+
"sata_uli"
42+
"sata_via"
43+
"sata_vsc"
44+
45+
"pata_ali"
46+
"pata_amd"
47+
"pata_artop"
48+
"pata_atiixp"
49+
"pata_efar"
50+
"pata_hpt366"
51+
"pata_hpt37x"
52+
"pata_hpt3x2n"
53+
"pata_hpt3x3"
54+
"pata_it8213"
55+
"pata_it821x"
56+
"pata_jmicron"
57+
"pata_marvell"
58+
"pata_mpiix"
59+
"pata_netcell"
60+
"pata_ns87410"
61+
"pata_oldpiix"
62+
"pata_pcmcia"
63+
"pata_pdc2027x"
64+
"pata_qdi"
65+
"pata_rz1000"
66+
"pata_serverworks"
67+
"pata_sil680"
68+
"pata_sis"
69+
"pata_sl82c105"
70+
"pata_triflex"
71+
"pata_via"
72+
"pata_winbond"
73+
74+
# SCSI support (incomplete).
75+
"3w-9xxx"
76+
"3w-xxxx"
77+
"aic79xx"
78+
"aic7xxx"
79+
"arcmsr"
80+
"hpsa"
81+
82+
# USB support, especially for booting from USB CD-ROM
83+
# drives.
84+
"uas"
85+
86+
# SD cards.
87+
"sdhci_pci"
88+
89+
# NVMe drives
90+
"nvme"
91+
92+
# Firewire support. Not tested.
93+
"ohci1394"
94+
"sbp2"
95+
96+
# Virtio (QEMU, KVM etc.) support.
97+
"virtio_net"
98+
"virtio_pci"
99+
"virtio_mmio"
100+
"virtio_blk"
101+
"virtio_scsi"
102+
"virtio_balloon"
103+
"virtio_console"
104+
105+
# VMware support.
106+
"mptspi"
107+
"vmxnet3"
108+
"vsock"
109+
]
110+
++ lib.optional platform.isx86 "vmw_balloon"
111+
++ lib.optionals (pkgs.stdenv.hostPlatform.isi686 || pkgs.stdenv.hostPlatform.isx86_64) [
112+
"vmw_vmci"
113+
"vmwgfx"
114+
"vmw_vsock_vmci_transport"
115+
116+
# Hyper-V support.
117+
"hv_storvsc"
118+
]
119+
++ lib.optionals pkgs.stdenv.hostPlatform.isAarch [
120+
# Allwinner support
121+
# Required for early KMS
122+
"sun4i-drm"
123+
"sun8i-mixer" # Audio, but required for kms
124+
125+
# PWM for the backlight
126+
"pwm-sun4i"
127+
128+
# Broadcom
129+
"vc4"
130+
]
131+
++ lib.optionals pkgs.stdenv.hostPlatform.isAarch64 [
132+
# Most of the following falls into two categories:
133+
# - early KMS / early display
134+
# - early storage (e.g. USB) support
135+
136+
# Broadcom
137+
138+
"pcie-brcmstb"
139+
140+
# Rockchip
141+
"dw-hdmi"
142+
"dw-mipi-dsi"
143+
"rockchipdrm"
144+
"rockchip-rga"
145+
"phy-rockchip-pcie"
146+
"pcie-rockchip-host"
147+
148+
# Misc. uncategorized hardware
149+
150+
# Used for some platform's integrated displays
151+
"panel-simple"
152+
"pwm-bl"
153+
154+
# Power supply drivers, some platforms need them for USB
155+
"axp20x-ac-power"
156+
"axp20x-battery"
157+
"pinctrl-axp209"
158+
"mp8859"
159+
160+
# USB drivers
161+
"xhci-pci-renesas"
162+
163+
# Reset controllers
164+
"reset-raspberrypi" # Triggers USB chip firmware load.
165+
166+
# Misc "weak" dependencies
167+
"analogix-dp"
168+
"analogix-anx6345" # For DP or eDP (e.g. integrated display)
169+
];
170+
171+
# Include lots of firmware.
172+
hardware.enableRedistributableFirmware = true;
173+
};
174+
}

nixos/modules/installer/cd-dvd/installation-cd-base.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
[ ./iso-image.nix
77

88
# Profiles of this basic installation CD.
9-
../../profiles/all-hardware.nix
109
../../profiles/base.nix
1110
../../profiles/installation-device.nix
1211
];
1312

13+
hardware.enableAllHardware = true;
14+
1415
# Adds terminus_font for people with HiDPI displays
1516
console.packages = options.console.packages.default ++ [ pkgs.terminus_font ];
1617

nixos/modules/installer/netboot/netboot-base.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ with lib;
1010
./netboot.nix
1111

1212
# Profiles of this basic netboot media
13-
../../profiles/all-hardware.nix
1413
../../profiles/base.nix
1514
../../profiles/installation-device.nix
1615
];
16+
17+
hardware.enableAllHardware = true;
1718
}

nixos/modules/installer/sd-card/sd-image.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ in
2929
imports = [
3030
(mkRemovedOptionModule [ "sdImage" "bootPartitionID" ] "The FAT partition for SD image now only holds the Raspberry Pi firmware files. Use firmwarePartitionID to configure that partition's ID.")
3131
(mkRemovedOptionModule [ "sdImage" "bootSize" ] "The boot files for SD image have been moved to the main ext4 partition. The FAT partition now only holds the Raspberry Pi firmware files. Changing its size may not be required.")
32-
../../profiles/all-hardware.nix
3332
];
3433

3534
options.sdImage = {
@@ -162,6 +161,8 @@ in
162161
};
163162

164163
config = {
164+
hardware.enableAllHardware = true;
165+
165166
fileSystems = {
166167
"/boot/firmware" = {
167168
device = "/dev/disk/by-label/${config.sdImage.firmwarePartitionName}";

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
./config/zram.nix
4949
./hardware/acpilight.nix
5050
./hardware/all-firmware.nix
51+
./hardware/all-hardware.nix
5152
./hardware/apple-touchbar.nix
5253
./hardware/bladeRF.nix
5354
./hardware/brillo.nix
Lines changed: 3 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,5 @@
1-
# This module enables all hardware supported by NixOS: i.e., all
2-
# firmware is included, and all devices from which one may boot are
3-
# enabled in the initrd. Its primary use is in the NixOS installation
4-
# CDs.
5-
6-
{ pkgs, lib,... }:
7-
let
8-
platform = pkgs.stdenv.hostPlatform;
9-
in
1+
# Set `hardware.enableAllHardware = true` instead of importing this file.
2+
# This file provides backwards compatibility for older configurations.
103
{
11-
12-
# The initrd has to contain any module that might be necessary for
13-
# supporting the most important parts of HW like drives.
14-
boot.initrd.availableKernelModules =
15-
[ # SATA/PATA support.
16-
"ahci"
17-
18-
"ata_piix"
19-
20-
"sata_inic162x" "sata_nv" "sata_promise" "sata_qstor"
21-
"sata_sil" "sata_sil24" "sata_sis" "sata_svw" "sata_sx4"
22-
"sata_uli" "sata_via" "sata_vsc"
23-
24-
"pata_ali" "pata_amd" "pata_artop" "pata_atiixp" "pata_efar"
25-
"pata_hpt366" "pata_hpt37x" "pata_hpt3x2n" "pata_hpt3x3"
26-
"pata_it8213" "pata_it821x" "pata_jmicron" "pata_marvell"
27-
"pata_mpiix" "pata_netcell" "pata_ns87410" "pata_oldpiix"
28-
"pata_pcmcia" "pata_pdc2027x" "pata_qdi" "pata_rz1000"
29-
"pata_serverworks" "pata_sil680" "pata_sis"
30-
"pata_sl82c105" "pata_triflex" "pata_via"
31-
"pata_winbond"
32-
33-
# SCSI support (incomplete).
34-
"3w-9xxx" "3w-xxxx" "aic79xx" "aic7xxx" "arcmsr" "hpsa"
35-
36-
# USB support, especially for booting from USB CD-ROM
37-
# drives.
38-
"uas"
39-
40-
# SD cards.
41-
"sdhci_pci"
42-
43-
# NVMe drives
44-
"nvme"
45-
46-
# Firewire support. Not tested.
47-
"ohci1394" "sbp2"
48-
49-
# Virtio (QEMU, KVM etc.) support.
50-
"virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "virtio_balloon" "virtio_console"
51-
52-
# VMware support.
53-
"mptspi" "vmxnet3" "vsock"
54-
] ++ lib.optional platform.isx86 "vmw_balloon"
55-
++ lib.optionals (pkgs.stdenv.hostPlatform.isi686 || pkgs.stdenv.hostPlatform.isx86_64) [
56-
"vmw_vmci" "vmwgfx" "vmw_vsock_vmci_transport"
57-
58-
# Hyper-V support.
59-
"hv_storvsc"
60-
] ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch [
61-
# Allwinner support
62-
# Required for early KMS
63-
"sun4i-drm"
64-
"sun8i-mixer" # Audio, but required for kms
65-
66-
# PWM for the backlight
67-
"pwm-sun4i"
68-
69-
# Broadcom
70-
"vc4"
71-
] ++ lib.optionals pkgs.stdenv.hostPlatform.isAarch64 [
72-
# Most of the following falls into two categories:
73-
# - early KMS / early display
74-
# - early storage (e.g. USB) support
75-
76-
# Broadcom
77-
78-
"pcie-brcmstb"
79-
80-
# Rockchip
81-
"dw-hdmi"
82-
"dw-mipi-dsi"
83-
"rockchipdrm"
84-
"rockchip-rga"
85-
"phy-rockchip-pcie"
86-
"pcie-rockchip-host"
87-
88-
# Misc. uncategorized hardware
89-
90-
# Used for some platform's integrated displays
91-
"panel-simple"
92-
"pwm-bl"
93-
94-
# Power supply drivers, some platforms need them for USB
95-
"axp20x-ac-power"
96-
"axp20x-battery"
97-
"pinctrl-axp209"
98-
"mp8859"
99-
100-
# USB drivers
101-
"xhci-pci-renesas"
102-
103-
# Reset controllers
104-
"reset-raspberrypi" # Triggers USB chip firmware load.
105-
106-
# Misc "weak" dependencies
107-
"analogix-dp"
108-
"analogix-anx6345" # For DP or eDP (e.g. integrated display)
109-
];
110-
111-
# Include lots of firmware.
112-
hardware.enableRedistributableFirmware = true;
113-
114-
imports =
115-
[ ../hardware/network/zydas-zd1211.nix ];
116-
4+
hardware.enableAllHardware = true;
1175
}

0 commit comments

Comments
 (0)