Confusing Home Manager behavior around `targets.genericLinux.gpu.enable`

I’ve got a minimal NixOS configuration that I stripped down to:

  inputs.nixpkgs.lib.nixosSystem {
    modules = [
      {
        home-manager.users.foobar.imports = [ { ... } ];
        nixpkgs.hostPlatform = "aarch64-linux";
      }
    ];
  };

This nearly instantiates a derivation, save for one failure here:

Essentially, I trigger a meta.platforms mismatch error when evaluating the targets.genericLinux.gpu.drivers attribute, because it ends up touching intel-media-driver. I traced this down to the fact that somehow, intel-media-driver is still present in the pkgs attribute of the buildEnv here:

This is confusing to me because as far as I can tell (and by manually reproducing the derivation callPackage in a REPL) there doesn’t seem to be any good reason why intel-media-driver should be making it through to the pkgs attribute.

Here’s the error for reference:

      … while evaluating derivation 'non-nixos-gpu'
         whose name attribute is located at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'passAsFile' of derivation 'non-nixos-gpu'
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/trivial-builders/default.nix:81:9:
           80|         inherit buildCommand name;
           81|         passAsFile = [ "buildCommand" ] ++ (derivationArgs.passAsFile or [ ]);
             |         ^
           82|       }

       … while evaluating the attribute 'passAsFile'
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:114:9:
          113|         # XXX: The size is somewhat arbitrary
          114|         passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
             |         ^
          115|       }

       … while evaluating a branch condition
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:114:22:
          113|         # XXX: The size is somewhat arbitrary
          114|         passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
             |                      ^
          115|       }

       … in the argument of the not operator
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:114:52:
          113|         # XXX: The size is somewhat arbitrary
          114|         passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
             |                                                    ^
          115|       }

       … while calling the 'lessThan' builtin
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:114:52:
          113|         # XXX: The size is somewhat arbitrary
          114|         passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
             |                                                    ^
          115|       }

       … while calling the 'stringLength' builtin
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:114:25:
          113|         # XXX: The size is somewhat arbitrary
          114|         passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
             |                         ^
          115|       }

       … while calling the 'toJSON' builtin
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:109:16:
          108|         pathsToLinkJSON = builtins.toJSON pathsToLink;
          109|         pkgs = builtins.toJSON chosenOutputs;
             |                ^
          110|         extraPathsFrom = lib.optional includeClosures (writeClosure pathsForClosure);

       … while evaluating list element at index 2

       … while evaluating attribute 'paths'
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:68:7:
           67|     chosenOutputs = map (drv: {
           68|       paths =
             |       ^
           69|         # First add the usual output(s): respect if user has chosen explicitly,

       … while evaluating list element at index 0
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/build-support/buildenv/default.nix:68:7:
           67|     chosenOutputs = map (drv: {
           68|       paths =
             |       ^
           69|         # First add the usual output(s): respect if user has chosen explicitly,

       … while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:50:17:
           49|     value = commonAttrs // {
           50|       outPath = builtins.getAttr outputName strict;
             |                 ^
           51|       drvPath = strict.drvPath;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'intel-media-driver-25.3.4'
         whose name attribute is located at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'buildInputs' of derivation 'intel-media-driver-25.3.4'
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/stdenv/generic/make-derivation.nix:593:13:
          592|             depsHostHost = elemAt (elemAt dependencies 1) 0;
          593|             buildInputs = elemAt (elemAt dependencies 1) 1;
             |             ^
          594|             depsTargetTarget = elemAt (elemAt dependencies 2) 0;

       … in the condition of the assert statement
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/lib/customisation.nix:412:15:
          411|             outPath =
          412|               assert condition;
             |               ^
          413|               drv.${outputName}.outPath;

       … while evaluating the attribute 'handled'
         at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/stdenv/generic/check-meta.nix:756:9:
          755|         # or, alternatively, just output a warning message.
          756|         handled = (
             |         ^
          757|           if valid == "yes" then

Any ideas? Super confusing. Maybe I have some serious misunderstanding here? How the heck am I tripping the x86_64-linux branch?

never mind I found it, closing - stale flake input where there was a legitimate bug.