pkgsCross with specific gcc version

The software I need to maintain does not build with current gcc.

How can I override the gcc used cross compiling in musl32?

thanx

You should be able to use stdenv = overrideCC stdenv buildPackages.gcc5; for the package I think

As far as I understand gcc should always be cross compiled with the native variant of the same version.
For instance: Trying to nix-build nixpkgs.pkgsStatic.gcc8 will fail because gcc7 does not provide cet headers. My workaround is to use a forked nixpkgs with version 8 as default.