From eca1957835ca7c6c14e9c9217e620b62ef643203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 23 Jan 2023 10:49:01 +0100 Subject: [PATCH 1/2] vendorize bcachefs kernel --- flake.nix | 5 +++++ linux-testing-bcachefs.nix | 28 ++++++++++++++++++++++++++++ tests/bcachefs.nix | 10 ++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 linux-testing-bcachefs.nix 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)); }; } From 232aed177d049ef5861b18b8c92fabba1e59b772 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 23 Jan 2023 08:30:15 +0000 Subject: [PATCH 2/2] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/37b97ae3dd714de9a17923d004a2c5b5543dfa6d' (2023-01-13) → 'github:NixOS/nixpkgs/cfb43ad7b941d9c3606fb35d91228da7ebddbfc5' (2023-01-20) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index fafd04a..112f96a 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1673606088, - "narHash": "sha256-wdYD41UwNwPhTdMaG0AIe7fE1bAdyHe6bB4HLUqUvck=", + "lastModified": 1674236650, + "narHash": "sha256-B4GKL1YdJnII6DQNNJ4wDW1ySJVx2suB1h/v4Ql8J0Q=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "37b97ae3dd714de9a17923d004a2c5b5543dfa6d", + "rev": "cfb43ad7b941d9c3606fb35d91228da7ebddbfc5", "type": "github" }, "original": {