nativeBuildInputs when cross-bulding for mingwW64

I have an issue cross-building a package for mingwW64 which uses unar to unpack a RAR archive. unar is a free software archive decompression tool written in Objective-C. Normal unrar is non-free software, so it has not been used in the package so far.

I am feeding unar into my package build using nativeBuildInputs. The package builds fine on x86_64-linux, however, when crossbuilding for mingw-w64, it fails when trying to build GNUstep from source. I’m confused why nix would be building unar - much less trying to build an Objective-C compiler from source. Shouldn’t it use the pre-built unar for the host machine?

The package looks something like this:

{ requireFile
, unar
, stdenv
, cmake
}:
let
  dataFiles = stdenv.mkDerivation {
      src = requireFile {
          name = "foo.rar";
          ...
      };

      nativeBuildInputs = [ unar ];
      unpackPhase = "unar -D $src";
      ...
  };
in stdenv.mkDerivation {
  cmakeFlags = [ "-DDATA_FILES=${dataFiles}" ];
  ...
}

It is being called like this:

foo = pkgs.pkgsCross.mingW64.callPackage ./foo { };

Is there a way to tell nix to use the native tools in the expected way?

Solved: nativeBuildInputs doesn’t do anything special to get the host version of a package. The package has to be acquired from the correct cross-packages e.g. pkgsBuildBuild.unar