Cross compiling nativeBuildInputs and pkg-config?

testttt = stdenv.mkDerivation {
    name = "a";
    nativeBuildInputs = [ pkg-config ];
    phases = ["buildPhase"];
    buildPhase = "pkg-config --help";

  nix-build  '<nixpkgs>' -A pkgsCross.raspberryPi.testttt

fails to show help, why ? I’d expect the pkg-config to be the building host version thus show the help. But instead I get arm version. Is my setup broken ?

1 Like

My guess would be that you refer to a target ‘pkg-config’ directly. I wonder if it Just Works if you put your expression in a separate .nix file and load it with callPackage similar to a typical package in nixpkgs.

I think it should be $PKG_CONFIG here. I don’t write derivations like this that often, so having trouble reproducing your environment. But it’s likely that $PKG_CONFIG works for this example (it should point to a prefixed pkg-config).