Dwm "postPatch is missing" although present

Hello, this may be a dumb question but I am completely stuck:
I wanted to try out dwm as window manager, using a local config.def.h file.
I followed the advice in the wiki:

  environment.systemPackages = with pkgs; [
    (dwm.overrideAttrs (oldAttrs: rec {
      configFile = writeText "config.def.h" (builtins.readFile /home/someone/Software/dwm/config.def.h);
      postPatch = oldAttrs.postPatch ++ ''cp ${configFile} config.def.h'';

But when I do nixos-rebuild test he fails with:

error: attribute 'postPatch' missing, at /etc/nixos/xserver-config.nix:6:19

Which is weird, since the ‘postPatch’ attribute is present.

Any Ideas ?

It’s missing in oldAttrs, as the overridden derivation didn’t have it.


(oldAttrs.postPatch or “”) ++