Skip to content

Commit b3e6c58

Browse files
oott123Mic92
authored andcommitted
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
1 parent af087d0 commit b3e6c58

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/make-disk-image.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ let
1414
checked = diskoCfg.checkScripts;
1515

1616
configSupportsZfs = config.boot.supportedFilesystems.zfs or false;
17+
configSupportsBcachefs = config.boot.supportedFilesystems.bcachefs or false;
1718
binfmt = diskoLib.binfmt {
1819
inherit
1920
diskoLib
@@ -41,6 +42,7 @@ let
4142
"virtio_rng"
4243
]
4344
++ (lib.optional configSupportsZfs "zfs")
45+
++ (lib.optional configSupportsBcachefs "bcachefs")
4446
++ cfg.extraRootModules;
4547
kernel = pkgs.aggregateModules (
4648
[
@@ -50,6 +52,9 @@ let
5052
++ lib.optional (
5153
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
5254
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}
55+
++ lib.optional (lib.elem "bcachefs" cfg.extraRootModules || configSupportsBcachefs) (
56+
cfg.kernelPackages.callPackage pkgs.bcachefs-tools.kernelModule { }
57+
)
5358
);
5459
}
5560
// lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {

0 commit comments

Comments
 (0)