Override sha256 hash

I just want to put some lines into my configuration.nix to test if a different hash fixes #49713. I think there should be a simpler way than cloning nixpkgs and edit it there.

After reading the doc NixOS - Nixpkgs 21.05 manual and several examples here and on GitHub, i came up with this (and several other constructs), but i always get very strage errors!

nixpkgs.config.packageOverrides = pkgs: {
  linuxPackages.ati_drivers_x11 = pkgs.linuxPackages.ati_drivers_x11.overrideAttrs (oldAttrs: rec {
    src = pkgs.fetchurl {
      url = "https://www2.ati.com/drivers/linux/radeon-crimson-15.12-15.302-151217a-297685e.zip";
      sha256 = "0n0ynqmjkjp5dl5q07as7ps3rlyyn63hq4mlwgd7c7v82ky2skvh";
      curlOpts = "--referer http://support.amd.com/en-us/download/desktop?os=Linux+x86_64";
    };
  });
};
[root@imac:~]# nixos-rebuild switch
building Nix...
building the system configuration...
error: attribute 'extend' missing, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/kernel.nix:39:31
(use '--show-trace' to show detailed location information)

Can someone give me a hint what is wrong here?

I think this is same problem as in

Or maybe see last Aszlig comment about how to do that via overlays The *correct* way to override the latest kernel config - #7 by aszlig

Hosted by Flying Circus.