Error when trying to override a package

I’m trying to override the xf86videoamdgpu and apply a patch to it. The patch rests on local disk. This is the overlay I have in configuration.nix:

  nixpkgs.overlays = [
    (self: super: {
      xorg.xf86videoamdgpu = super.xorg.xf86videoamdgpu.overrideAttrs (old: {
        patches = [/path/to/patchfile.patch];
      });
    })
  ];

But nix-rebuild gives me the following error:

  error: anonymous function at /nix/store/04ck4nckra6933g5r0ffy1m452zvh4ij-nixos-20.03beta874.b0c285807d6/nixos/pkgs/os-specific/linux/amdgpu-pro/default.nix:1:1 called without required argument 'libxcb', at /nix/store/04ck4nckra6933g5r0ffy1m452zvh4ij-nixos-20.03beta874.b0c285807d6/nixos/lib/customisation.nix:69:16

It does not seem to care about that patches line at all, if I remove it I get the error, too. I’ve also tried the nixpkgs.config.packageOverrides method but the error I got was similar.

Check the ‘overriden attrset’ section of https://blog.flyingcircus.io/2017/11/07/nixos-the-dos-and-donts-of-nixpkgs-overlays/

xorg.xf86videoamdgpu = foo; here is syntax sugar for xorg = { xf86videoamdgpu = foo }; so what was in the mentioned blog post applies

Thanks! This fixed it for me!