Kernel patch applying twice

I have a custom kernel patch build here:

Building the kernel with nix-build builds the kernel fine.

But when I try to include it in an overlay, and use some other kernel patches, and then issue nixos-rebuild build, nixos applies the patch twice and fails.

Why is this applying the patch twice?

I assume that you are on the nixos-21.05 stable channel? The issue should be fixed since nixos/boot: properly override the kernel in boot.kernelPatches by xaverdh · Pull Request #124486 · NixOS/nixpkgs · GitHub was backported.