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