From c8ffaf71e7ed496ee4ce752bd4c6d1b7e7a6dd27 Mon Sep 17 00:00:00 2001 From: oott123 Date: Sun, 9 Nov 2025 15:09:34 +0800 Subject: [PATCH] add support for extra kernel module packages in disk image builder --- lib/make-disk-image.nix | 1 + module.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/make-disk-image.nix b/lib/make-disk-image.nix index 352141f9..0186d4aa 100644 --- a/lib/make-disk-image.nix +++ b/lib/make-disk-image.nix @@ -50,6 +50,7 @@ let ++ lib.optional ( lib.elem "zfs" cfg.extraRootModules || configSupportsZfs ) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute} + ++ cfg.extraRootModulePackages ); } // lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) { diff --git a/module.nix b/module.nix index 24d2305a..bc03651f 100644 --- a/module.nix +++ b/module.nix @@ -72,6 +72,18 @@ in example = [ "bcachefs" ]; }; + extraRootModulePackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + description = '' + extra kernel module packages to include in the disk image builder VM. + Useful when you need kernel modules that are not part of the main kernel package. + ''; + default = [ ]; + example = lib.literalExpression '' + [ config.boot.kernelPackages.bcachefs ] + ''; + }; + extraPostVM = lib.mkOption { type = lib.types.lines; description = ''