make-disk-image: auto-detect bcachefs kernel module like zfs

Automatically include the bcachefs kernel module when bcachefs is detected in
extraRootModules or boot.supportedFilesystems.

This follows the same pattern as ZFS.

Fixes #1151
This commit is contained in:
oott123 authored and Jörg Thalheim committed 2025-11-20 15:00:35 +01:00
1 parent af087d076d
commit 9067124b0d
1 file changed
+6
+6
View File
@@ -14,6 +14,7 @@ let
checked = diskoCfg.checkScripts;
configSupportsZfs = config.boot.supportedFilesystems.zfs or false;
configSupportsBcachefs = config.boot.supportedFilesystems.bcachefs or false;
binfmt = diskoLib.binfmt {
inherit
diskoLib
@@ -41,6 +42,7 @@ let
"virtio_rng"
]
++ (lib.optional configSupportsZfs "zfs")
++ (lib.optional configSupportsBcachefs "bcachefs")
++ cfg.extraRootModules;
kernel = pkgs.aggregateModules (
[
@@ -50,6 +52,10 @@ let
++ lib.optional (
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}
++ lib.optional (
(lib.elem "bcachefs" cfg.extraRootModules || configSupportsBcachefs)
&& pkgs.bcachefs-tools ? kernelModule
) (cfg.kernelPackages.callPackage pkgs.bcachefs-tools.kernelModule { })
);
}
// lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {