{ lib , fetchpatch , kernel , commitDate ? "2022-09-28" , currentCommit ? "24c6361e202cc09de0159505eb3ab3ca265520d8" , diffHash ? "sha256-Y3uKkVMCaLGJpYb27ef3FfbqEQ32mgCVpWtYzvYamr8=" , 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; }))