From 9067124b0d9913b3a0103f693d65459b5539f110 Mon Sep 17 00:00:00 2001 From: oott123 Date: Sun, 9 Nov 2025 15:09:34 +0800 Subject: [PATCH] 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 --- lib/make-disk-image.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/make-disk-image.nix b/lib/make-disk-image.nix index 352141f9..912b49f7 100644 --- a/lib/make-disk-image.nix +++ b/lib/make-disk-image.nix @@ -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) {