Compare commits

...
Author SHA1 Message Date
oott123 9067124b0d 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
2025-11-20 15:00:35 +01:00
+6
View File
@@ -14,6 +14,7 @@ let
checked = diskoCfg.checkScripts; checked = diskoCfg.checkScripts;
configSupportsZfs = config.boot.supportedFilesystems.zfs or false; configSupportsZfs = config.boot.supportedFilesystems.zfs or false;
configSupportsBcachefs = config.boot.supportedFilesystems.bcachefs or false;
binfmt = diskoLib.binfmt { binfmt = diskoLib.binfmt {
inherit inherit
diskoLib diskoLib
@@ -41,6 +42,7 @@ let
"virtio_rng" "virtio_rng"
] ]
++ (lib.optional configSupportsZfs "zfs") ++ (lib.optional configSupportsZfs "zfs")
++ (lib.optional configSupportsBcachefs "bcachefs")
++ cfg.extraRootModules; ++ cfg.extraRootModules;
kernel = pkgs.aggregateModules ( kernel = pkgs.aggregateModules (
[ [
@@ -50,6 +52,10 @@ let
++ lib.optional ( ++ lib.optional (
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute} ) 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) { // lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {