I always forget the different between the type of build inputs in a nix derivation.
Here is my explanation.
buildInputs
: are for libraries loaded during execution.
nativeBuildInputs
: are compilation libraries
Sometimes the libraries of nativeBuildInputs are not populated correctly by pkg-config. If I ever find a solution to this I will post it here. The only working solution I have is:
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;