bcachefs-kernel-module: Nest within bcachefs-tools (#446975)

This commit is contained in:
Masum Reza
2025-09-30 05:34:59 +00:00
committed by GitHub
4 changed files with 25 additions and 6 deletions

View File

@@ -178,8 +178,20 @@ let
in
{
options.boot.bcachefs.package = lib.mkPackageOption pkgs "bcachefs-tools" { } // {
description = "Configured Bcachefs userspace package.";
options.boot.bcachefs = {
package = lib.mkPackageOption pkgs "bcachefs-tools" {
extraDescription = ''
This package should also provide a passthru 'kernelModule'
attribute to build the out-of-tree kernel module.
'';
};
modulePackage = lib.mkOption {
type = lib.types.package;
# See NOTE in linux-kernels.nix
default = config.boot.kernelPackages.callPackage cfg.package.kernelModule { };
internal = true;
};
};
options.services.bcachefs.autoScrub = {
@@ -245,8 +257,8 @@ in
system.fsPackages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
boot.extraModulePackages = lib.optionals (!config.boot.kernelPackages.bcachefs.meta.broken) [
config.boot.kernelPackages.bcachefs
boot.extraModulePackages = lib.optionals (!cfg.modulePackage.meta.broken) [
cfg.modulePackage
];
systemd = {

View File

@@ -1,7 +1,7 @@
bcachefs-tools:
{
lib,
stdenv,
bcachefs-tools,
kernelModuleMakeFlags,
kernel,
}:

View File

@@ -118,6 +118,9 @@ stdenv.mkDerivation (finalAttrs: {
'';
passthru = {
# See NOTE in linux-kernels.nix
kernelModule = import ./kernel-module.nix finalAttrs.finalPackage;
tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;

View File

@@ -375,7 +375,11 @@ in
bbswitch = callPackage ../os-specific/linux/bbswitch { };
bcachefs = callPackage ../os-specific/linux/bcachefs-kernel-module { };
# NOTE: The bcachefs module is called this way to facilitate
# easy overriding, as it is expected many users will want to
# pull from the upstream git repo, which may include
# unreleased changes to the module build process.
bcachefs = callPackage pkgs.bcachefs-tools.kernelModule { };
ch9344 = callPackage ../os-specific/linux/ch9344 { };