Why do I get conflicting definiton values for hardware.deviceTree.filter for Pi4?

In the NixOS Wiki, it says to use this filter

  hardware = {
    raspberry-pi."4".apply-overlays-dtmerge.enable = true;
    deviceTree = {
      enable = true;
      filter = "*rpi-4-*.dtb";
    };
  };

, but then I get:

error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nixos-system-pi-24.05.20240509.f1010e0'
         whose name attribute is located at /nix/store/asymc3nsl739p1wwr0w6xbjnqs3qb94p-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'nixos-system-pi-24.05.20240509.f1010e0'

         at /nix/store/asymc3nsl739p1wwr0w6xbjnqs3qb94p-source/nixos/modules/system/activation/top-level.nix:53:5:

           52|     passAsFile = [ "extraDependencies" ];
           53|     buildCommand = systemBuilder;
             |     ^
           54|

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `hardware.deviceTree.filter' has conflicting definition values:
       - In `/nix/store/lwlj29my7yhn41indi3m5bvcrrc398yg-nixos-hardware/nixos-hardware/raspberry-pi/4/modesetting.nix': "bcm2711-rpi-4*.dtb"
       - In `/nix/store/kx8p0ah21w6xg6pqkb9ll83jxpkyqw5x-source/configuration.nix': "*rpi-4-*.dtb"
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Nobody got a clue here?

This is the official documentation of NixOS on the Pi4, so I wonder how anybody gets this working?

The find the cause just look at these two lines:

       - In `/nix/store/lwlj29my7yhn41indi3m5bvcrrc398yg-nixos-hardware/nixos-hardware/raspberry-pi/4/modesetting.nix': "bcm2711-rpi-4*.dtb"
       - In `/nix/store/kx8p0ah21w6xg6pqkb9ll83jxpkyqw5x-source/configuration.nix': "*rpi-4-*.dtb"

The first line says that the mention file sets the filter to “bcm2711-rpi-4*.dtb” and the second line is your file.

For this to be true you have to have also set options.hardware.raspberry-pi."4".fkms-3d.enable to true (somewhere).

I suggest just removing the manual setting of the filter.

I already had the fkms-3d line and if I also remove the manual setting of the filter, I get:

  hardware = {
    raspberry-pi."4".apply-overlays-dtmerge.enable = true;
    # deviceTree = {
    #   enable = true;
    #   filter = "*rpi-4-*.dtb";
    # };
  };

, but I get this:

building '/nix/store/xh7awwwwdpr7v7hpgi0ngr5lgxir8bhy-device-tree-overlays.drv'...
./broadcom -> /nix/store/g1vryd1fi3rnp14lclkpvviq26lnlfk3-device-tree-overlays/./broadcom
'./broadcom/bcm2711-rpi-4-b.dtb' -> '/nix/store/g1vryd1fi3rnp14lclkpvviq26lnlfk3-device-tree-overlays/./broadcom/bcm2711-rpi-4-b.dtb'
'./broadcom/bcm2711-rpi-400.dtb' -> '/nix/store/g1vryd1fi3rnp14lclkpvviq26lnlfk3-device-tree-overlays/./broadcom/bcm2711-rpi-400.dtb'
Applying overlay rpi4-cma-overlay to bcm2711-rpi-4-b.dtb... ok
Applying overlay rpi4-vc4-fkms-v3d-overlay to bcm2711-rpi-4-b.dtb... ok
Applying overlay rpi4-cpu-revision to bcm2711-rpi-4-b.dtb... ok
Applying overlay audio-on-overlay to bcm2711-rpi-4-b.dtb... DTOVERLAY[error]: can't find symbol 'audio'
error: builder for '/nix/store/xh7awwwwdpr7v7hpgi0ngr5lgxir8bhy-device-tree-overlays.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/rr5fm2c4y1yqk6fgdgmaj4xhbjgqb1fw-nixos-system-pi-23.11.20240604.a2e1d04.drv' failed to build

ok, I figured it out, from this

I had to remove

hardware.raspberry-pi."4".audio.enable = true;

Now it works and I get sound;) Thanks