{ lib , fetchpatch , kernel , commitDate ? "2022-12-07" , currentCommit ? "d73d13472d932df2ecf3cbc5fb122be2d06c6a73" , diffHash ? "sha256-//0H6Ax24qoHx1iR0s+HGDhEm6mSJwtrKmzN5trNbcw=" , 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; }))