Skip to content

Commit 9067124

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 9067124

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/make-disk-image.nix

Lines changed: 6 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,10 @@ let
5052
++ lib.optional (
5153
lib.elem "zfs" cfg.extraRootModules || configSupportsZfs
5254
) cfg.kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}
55+
++ lib.optional (
56+
(lib.elem "bcachefs" cfg.extraRootModules || configSupportsBcachefs)
57+
&& pkgs.bcachefs-tools ? kernelModule
58+
) (cfg.kernelPackages.callPackage pkgs.bcachefs-tools.kernelModule { })
5359
);
5460
}
5561
// lib.optionalAttrs (diskoLib.vmToolsSupportsCustomQemu lib) {

0 commit comments

Comments
 (0)