Overwriting nixpkgs.localSystem.linux-kernel not considered when generating VM

Hi all,

I would like to generate a NixOS QEMU VM to test a Linux kernel driver with the GPIO simulator. For this, I need to enable device tree support in the kernel, patch the kernel with my custom DTS file, and, this is the culprit here, enable device tree build, like in this flake:

{
  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    utils.url = github:numtide/flake-utils;
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, utils, nixos-generators }:
    utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {
        packages = {
          vm = nixos-generators.nixosGenerate {
            modules = [
              {
                boot = {
                  kernelParams = [ "acpi=off" ]; # Keep device tree after early boot
                  kernelPatches = with pkgs; [ {
                    name = "gpio_sim";
                    patch = ./gpio_sim_dts.patch;
                    extraStructuredConfig = with lib.kernel; {
                      GPIO_SIM = yes;
                      OF = module;
                    };
                  }];
                  kernelPackages = pkgs.linuxPackages_latest;
                };
                hardware.deviceTree = {
                  enable = true;
                  filter = "gpio_sim.dtb";
                };
                nixpkgs.localSystem = {
                  system = "x86_64-linux";
                  linux-kernel = pkgs.lib.systems.platforms.pc.linux-kernel // {
                    DTB = true;
                  };
                };
                ...
              }
            ];
            system = "x86_64-linux";
            format = "vm";
          };
        };
      });
}

However it looks like that nixpkgs.localSystem.linux-kernel.DTB, which enables DTB build in the kernel derivation (disabled by default on x86, as normally ACPI is used), is not considered, as no DTBs are getting installed into the kernel output package, resulting in the following error when generating the VM via nix build .#vm:

error: builder for '/nix/store/b8xj5ilaachnm3720b20yn8aa6m5i4f1-dtbs-filtered.drv' failed with exit code 1;
       last 1 log lines:
       > /build/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 2: cd: /nix/store/2j4m6b8kjyjllfgf8l7sfsv0jvy83a7v-linux-6.11/dtbs: No such file or directory
       For full logs, run 'nix log /nix/store/b8xj5ilaachnm3720b20yn8aa6m5i4f1-dtbs-filtered.drv'.
error: 1 dependencies of derivation '/nix/store/p6hknvzgx2kvp6vlnaizcq20d9f8i226-nixos-system-nixos-24.11.20240919.c04d565.drv' failed to build
error: 1 dependencies of derivation '/nix/store/h0bvqlrg0iybr8x2biqvcxrvb8qpqfy6-nixos-vm.drv' failed to build

I still see that nixpkgs.localSystem.linux-kernel is evaluated as setting invalid attributes will result in an error. What am I doing wrong here?