Skip to content

Commit a82062e

Browse files
nixos/stage-1: Add option for allowing missing modules
1 parent 5df4362 commit a82062e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

nixos/modules/system/boot/kernel.nix

+14
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,20 @@ in
223223
'';
224224
};
225225

226+
boot.initrd.allowMissingModules = mkOption {
227+
type = types.bool;
228+
default = false;
229+
description = ''
230+
Whether the initrd can be built even though modules listed in
231+
{option}`boot.initrd.kernelModules` or
232+
{option}`boot.initrd.availableKernelModules` are missing from
233+
the kernel. This is useful when combining configurations that
234+
include a lot of modules, such as
235+
{option}`hardware.enableAllHardware`, with kernels that don't
236+
provide as many modules as typical NixOS kernels.
237+
'';
238+
};
239+
226240
system.modulesTree = mkOption {
227241
type = types.listOf types.path;
228242
internal = true;

nixos/modules/system/boot/stage-1.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let
1818
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
1919
kernel = config.system.modulesTree;
2020
firmware = config.hardware.firmware;
21-
allowMissing = false;
21+
allowMissing = config.boot.initrd.allowMissingModules;
2222
};
2323

2424

nixos/modules/system/boot/systemd/initrd.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let
104104
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
105105
kernel = config.system.modulesTree;
106106
firmware = config.hardware.firmware;
107-
allowMissing = false;
107+
allowMissing = config.boot.initrd.allowMissingModules;
108108
};
109109

110110
initrdBinEnv = pkgs.buildEnv {

0 commit comments

Comments
 (0)