{ lib , fetchpatch , kernel , commitDate ? "2022-12-29" , currentCommit ? "8f064a4cb5c7cce289b83d7a459e6d8620188b37" , diffHash ? "sha256-RnlM7uOSWhFHG1aj5BOjrfRtoZfbx+tqQw1V49nW5vw=" , 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-${commitDate}"; extraMeta = { branch = "master"; maintainers = with lib.maintainers; [ davidak Madouura ]; }; } // argsOverride; kernelPatches = [ { name = "bcachefs-${currentCommit}"; patch = fetchpatch { name = "bcachefs-${currentCommit}.diff"; url = "https://evilpiepirate.org/git/bcachefs.git/rawdiff/?id=${currentCommit}&id2=v${lib.versions.majorMinor kernel.version}"; sha256 = diffHash; }; extraConfig = "BCACHEFS_FS m"; } ] ++ kernelPatches; }))