Binaries for cross compilers


I’m trying to create a nix-shell with gcc that will cross-compile to arm. It works, but whenever I update nix, or change versions of GCC, I end up having to build it (GCC) from source, which takes quite a while.

Here’s my (simplified) default.nix

with import <nixpkgs> {};
  arm = import <nixpkgs> { crossSystem.config = "armv7l-unknown-linux-musleabihf"; };
stdenv.mkDerivation {
  name = "foo";
  buildInputs = filter [

This seems to be the case regardless of my choice of crossSystem, even if it’s one of the examples from the nixpkgs repo.

Are there pre-built cross compilers somewhere?


If you’re ok with using glibc instead of musl, you could use armv7l-unknown-linux-gnueabihf instead of armv7l-unknown-linux-musleabihf. The official binary cache already has the glibc version of GCC (in nixpkgs unstable it’s /nix/store/74fqm2bidqvf242qawxsl3rl08rarak3-gcc-debug-8.3.0-armv7l-unknown-linux-gnueabihf). You just need to build the gcc wrapper, but this only takes a few seconds.

don’t forget scoping, your stdenv on line 5 is still being inherited from the with import <nixpkgs> {}; on line 1