1{ lib
2, stdenv
3, fetchpatch
4, kernel
5, commitDate ? "2023-06-28"
6# bcachefs-tools stores the expected-revision in:
7# https://evilpiepirate.org/git/bcachefs-tools.git/tree/.bcachefs_revision
8# but this does not means that it'll be the latest-compatible revision
9, currentCommit ? "4d2faeb4fb58c389dc9f76b8d5ae991ef4497e04"
10, diffHash ? "sha256-DtMc8P4lTRzvS6PVvD7WtWEPsfnxIXSpqMsKKWs+edI="
11, kernelPatches # must always be defined in bcachefs' all-packages.nix entry because it's also a top-level attribute supplied by callPackage
12, argsOverride ? {}
13, ...
14} @ args:
15# NOTE: bcachefs-tools should be updated simultaneously to preserve compatibility
16(kernel.override ( args // {
17
18 argsOverride = {
19 version = "${kernel.version}-bcachefs-unstable-${commitDate}";
20 modDirVersion = kernel.modDirVersion;
21
22 extraMeta = {
23 homepage = "https://bcachefs.org/";
24 branch = "master";
25 maintainers = with lib.maintainers; [ davidak Madouura pedrohlc raitobezarius YellowOnion ];
26 };
27 } // argsOverride;
28
29 structuredExtraConfig = with lib.kernel; {
30 BCACHEFS_FS = module;
31 BCACHEFS_QUOTA = option yes;
32 BCACHEFS_POSIX_ACL = option yes;
33 # useful for bug reports
34 FTRACE = option yes;
35 };
36
37 kernelPatches = [ {
38 name = "bcachefs-${currentCommit}";
39
40 patch = fetchpatch {
41 name = "bcachefs-${currentCommit}.diff";
42 url = "https://evilpiepirate.org/git/bcachefs.git/rawdiff/?id=${currentCommit}&id2=v${lib.versions.majorMinor kernel.version}";
43 sha256 = diffHash;
44 };
45 } ] ++ kernelPatches;
46}))