diff --git a/flake.nix b/flake.nix index 51eef2c..1f1ecfd 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,11 @@ disko = pkgs.callPackage ./package.nix {}; disko-doc = pkgs.callPackage ./doc.nix { }; default = self.packages.${system}.disko; + # The way bcachefs support is maintained in nixpkgs is prone to breakage. + # That's why we need to maintain a fork here: + # https://github.com/NixOS/nixpkgs/issues/212086 + linux-bcachefs = pkgs.callPackage ./linux-testing-bcachefs.nix {}; + linuxPackages_bcachefs = pkgs.linuxPackagesFor self.packages.${pkgs.system}.linux-bcachefs; }); # TODO: disable bios-related tests on aarch64... # Run checks: nix flake check -L diff --git a/linux-testing-bcachefs.nix b/linux-testing-bcachefs.nix new file mode 100644 index 0000000..12529f9 --- /dev/null +++ b/linux-testing-bcachefs.nix @@ -0,0 +1,28 @@ +# nixpkgs's variant is broken because they have non-applying patches on top of the latest kernel, +# instead of using kernel. + +{ lib +, buildLinux +, fetchFromGitHub +, ... +} @ args: +buildLinux (args // { + # NOTE: bcachefs-tools should be updated simultaneously to preserve compatibility + version = "6.1.0-2022-12-29"; + modDirVersion = "6.1.0"; + + src = fetchFromGitHub { + owner = "koverstreet"; + repo = "bcachefs"; + rev = "8f064a4cb5c7cce289b83d7a459e6d8620188b37"; + sha256 = "sha256-UgWAbYToauAjGrgeS+o6N42/oW0roICJIoJlEAHBRPk="; + }; + + kernelPatches = (args.kernelPatches or []) ++ [{ + name = "bcachefs-config"; + patch = null; + extraConfig = '' + BCACHEFS_FS m + ''; + }]; +} // (args.argsOverride or {})) diff --git a/tests/bcachefs.nix b/tests/bcachefs.nix index 58ca8d3..d78d870 100644 --- a/tests/bcachefs.nix +++ b/tests/bcachefs.nix @@ -1,6 +1,9 @@ { pkgs ? (import { }) , makeDiskoTest ? (pkgs.callPackage ./lib.nix { }).makeDiskoTest }: +let + linux-bcachefs = pkgs.callPackage ../linux-testing-bcachefs.nix {}; +in makeDiskoTest { disko-config = ../example/bcachefs.nix; extraTestScript = '' @@ -12,7 +15,10 @@ makeDiskoTest { boot.supportedFilesystems = [ "bcachefs" ]; # disable zfs so we can support latest kernel nixpkgs.overlays = [(final: super: { - zfs = super.zfs.overrideAttrs(_: {meta.platforms = [];});} - )]; + zfs = super.zfs.overrideAttrs(_: { + meta.platforms = []; + }); + })]; + boot.kernelPackages = pkgs.lib.mkForce (pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux-bcachefs)); }; }