git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: fixup build of aarch64 minimal ISO (fixes #109252)

Perhaps it's not pretty nor precise; feel free to improve.

commit8ca33835bae0e9158f0a686dbeb139d979943064 authorVladimír Čunát <v@cunat.cz> dateWed 13 Jan 2021, 14:02 (6 years ago) parent9534559
4 files changed+41−18
nixos/modules/installer/cd-dvd/iso-image.nix+7−3 nixos/modules/profiles/all-hardware.nix+16−6 nixos/modules/system/boot/kernel.nix+13−7 nixos/modules/tasks/filesystems/ext.nix+5−2
nixos/modules/installer/cd-dvd/iso-image.nix+7−3
@@ -397,6 +397,8 @@ let
397397 # Syslinux (and isolinux) only supports x86-based architectures.
398398 canx86BiosBoot = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
399399
400+ # Some modules apparently aren't present on our aarch64 (and maybe elsewhere).
401+ maybeInitrdModules = lib.optionals (!pkgs.stdenv.hostPlatform.isAarch64);
400402in
401403
402404{
@@ -615,9 +617,11 @@ in
615617 ];
616618 };
617619
618− boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "uas" "overlay" ];
620+ boot.initrd.availableKernelModules = [ "iso9660" "uas" "overlay" ]
621+ ++ maybeInitrdModules [ "squashfs" ];
619622
620− boot.initrd.kernelModules = [ "loop" "overlay" ];
623+ boot.initrd.kernelModules = [ "overlay" ]
624+ ++ maybeInitrdModules [ "loop" ];
621625
622626 # Closures to be copied to the Nix store on the CD, namely the init
623627 # script and the top-level system configuration directory.
@@ -716,7 +720,7 @@ in
716720
717721 # Add vfat support to the initrd to enable people to copy the
718722 # contents of the CD to a bootable USB stick.
719− boot.initrd.supportedFilesystems = [ "vfat" ];
723+ boot.initrd.supportedFilesystems = maybeInitrdModules [ "vfat" ];
720724
721725 };
722726
nixos/modules/profiles/all-hardware.nix+16−6
@@ -3,20 +3,24 @@
33# enabled in the initrd. Its primary use is in the NixOS installation
44# CDs.
55
6−{ ... }:
7−
6+{ pkgs, lib,... }:
7+let
8+ platform = pkgs.stdenv.hostPlatform;
9+in
810{
911
1012 # The initrd has to contain any module that might be necessary for
1113 # supporting the most important parts of HW like drives.
1214 boot.initrd.availableKernelModules =
13− [ # SATA/PATA support.
15+ # SATA/PATA support.
16+ lib.optionals (!platform.isAarch64) [ # not sure where else they're missing
1417 "ahci"
15−
18+ "sata_sil24"
19+ ] ++ [
1620 "ata_piix"
1721
1822 "sata_inic162x" "sata_nv" "sata_promise" "sata_qstor"
19− "sata_sil" "sata_sil24" "sata_sis" "sata_svw" "sata_sx4"
23+ "sata_sil" "sata_sis" "sata_svw" "sata_sx4"
2024 "sata_uli" "sata_via" "sata_vsc"
2125
2226 "pata_ali" "pata_amd" "pata_artop" "pata_atiixp" "pata_efar"
@@ -38,13 +42,19 @@
3842 # Firewire support. Not tested.
3943 "ohci1394" "sbp2"
4044
45+ ] ++ lib.optionals (!platform.isAarch64) [ # not sure where else they're missing
4146 # Virtio (QEMU, KVM etc.) support.
4247 "virtio_net" "virtio_pci" "virtio_blk" "virtio_scsi" "virtio_balloon" "virtio_console"
48+ ] ++ [
4349
4450 # VMware support.
45− "mptspi" "vmw_balloon" "vmwgfx" "vmw_vmci" "vmw_vsock_vmci_transport" "vmxnet3" "vsock"
51+ "mptspi" "vmxnet3" "vsock"
52+ ] ++ lib.optionals (!platform.isAarch64) [ # not sure where else they're missing
53+ "vmw_vmci" "vmwgfx" "vmw_vsock_vmci_transport"
54+ ] ++ lib.optional platform.isx86 "vmw_balloon"
4655
4756 # Hyper-V support.
57+ ++ lib.optionals (!platform.isAarch64) [ # not sure where else they're missing
4858 "hv_storvsc"
4959 ];
5060
nixos/modules/system/boot/kernel.nix+13−7
@@ -194,31 +194,37 @@ in
194194
195195 config = mkMerge
196196 [ (mkIf config.boot.initrd.enable {
197− boot.initrd.availableKernelModules =
198− [ # Note: most of these (especially the SATA/PATA modules)
197+ boot.initrd.availableKernelModules = let
198+ # Some modules apparently aren't present on our aarch64 (and maybe elsewhere).
199+ maybeInitrdModules = lib.optionals (!pkgs.stdenv.hostPlatform.isAarch64);
200+ in
201+ # Note: most of these (especially the SATA/PATA modules)
199202 # shouldn't be included by default since nixos-generate-config
200203 # detects them, but I'm keeping them for now for backwards
201204 # compatibility.
202205
203206 # Some SATA/PATA stuff.
204− "ahci"
207+ maybeInitrdModules [ "ahci" ]
208+ ++ [
205209 "sata_nv"
206210 "sata_via"
207211 "sata_sis"
208212 "sata_uli"
209213 "ata_piix"
210214 "pata_marvell"
215+ ]
211216
212217 # Standard SCSI stuff.
213− "sd_mod"
214− "sr_mod"
218+ ++ maybeInitrdModules [ "sd_mod" ]
219+ ++ [ "sr_mod" ]
215220
216221 # SD cards and internal eMMC drives.
217− "mmc_block"
222+ ++ maybeInitrdModules [ "mmc_block" ]
218223
219224 # Support USB keyboards, in case the boot fails and we only have
220225 # a USB keyboard, or for LUKS passphrase prompt.
221− "uhci_hcd"
226+ ++ [ "uhci_hcd" ]
227+ ++ maybeInitrdModules [
222228 "ehci_hcd"
223229 "ehci_pci"
224230 "ohci_hcd"
nixos/modules/tasks/filesystems/ext.nix+5−2
@@ -1,4 +1,4 @@
1−{ pkgs, ... }:
1+{ pkgs, lib, ... }:
22
33{
44 config = {
@@ -6,7 +6,10 @@
66 system.fsPackages = [ pkgs.e2fsprogs ];
77
88 # As of kernel 4.3, there is no separate ext3 driver (they're also handled by ext4.ko)
9− boot.initrd.availableKernelModules = [ "ext2" "ext4" ];
9+ # No ext* modules are present on our aarch64, apparently (and maybe elsewhere).
10+ boot.initrd.availableKernelModules =
11+ lib.optionals (!pkgs.stdenv.hostPlatform.isAarch64)
12+ [ "ext2" "ext4" ];
1013
1114 boot.initrd.extraUtilsCommands =
1215 ''