Skip to content

Commit 1afee75

Browse files
nixos/stage-1: Add option for allowing missing modules
1 parent 623a88d commit 1afee75

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

nixos/modules/system/boot/kernel.nix

+18
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,24 @@ in
242242
'';
243243
};
244244

245+
boot.initrd.allowMissingModules = mkOption {
246+
type = types.bool;
247+
default = false;
248+
description = ''
249+
Whether the initrd can be built even though modules listed in
250+
{option}`boot.initrd.kernelModules` or
251+
{option}`boot.initrd.availableKernelModules` are missing from
252+
the kernel. This is useful when combining configurations that
253+
include a lot of modules, such as
254+
{option}`hardware.enableAllHardware`, with kernels that don't
255+
provide as many modules as typical NixOS kernels.
256+
257+
Note that enabling this is discouraged. Instead, try disabling
258+
individual modules by setting e.g.
259+
`boot.initrd.availableKernelModules.foo = lib.mkForce false;`
260+
'';
261+
};
262+
245263
system.modulesTree = mkOption {
246264
type = types.listOf types.path;
247265
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

0 commit comments

Comments
 (0)