{ lib , fetchpatch , kernel , date ? "2022-03-21" , commit ? "c38b7167aa5f3b1b91dcc93ade57f30e95064590" , diffHash ? "04lgwnng7p2rlz9sxn74n22750kh524xwfws3agqs12pcrvfsm0j" , kernelPatches # must always be defined in bcachefs' all-packages.nix entry because it's also a top-level attribute supplied by callPackage , argsOverride ? {} , ... } @ args: # NOTE: bcachefs-tools should be updated simultaneously to preserve compatibility (kernel.override ( args // { argsOverride = { version = "${kernel.version}-bcachefs-unstable-${date}"; extraMeta = { branch = "master"; maintainers = with lib.maintainers; [ davidak Madouura ]; }; } // argsOverride; kernelPatches = [ { name = "bcachefs-${commit}"; patch = fetchpatch { name = "bcachefs-${commit}.diff"; url = "https://evilpiepirate.org/git/bcachefs.git/rawdiff/?id=${commit}&id2=v${lib.versions.majorMinor kernel.version}"; sha256 = diffHash; }; extraConfig = "BCACHEFS_FS m"; } ] ++ kernelPatches; }))