Are cross-compilers cached?

I’m using Nix to set up a development environment and I’d like to add a cross compiler to that environment (specifically, I want my development environment to be able to compile the linux kernel for “arm64”, which Nix calls “aarch64” and Arm calls “A64”).

I do not expect cross-compiled packages to be available in the public binary caches.

But my question is whether I should expect the cross-compiler to be available? I.e. if I do this:

  pkgsAarch64 = import inputs.nixpkgs {
    localSystem = pkgs.system;
    crossSystem = "aarch64-linux";
  };

And then add pkgsAarch64.gcc to my devShell, I observe that I have to compile GCC.

I guess there may also be a “teach a man to fish” answer here.. how would one figure this out for oneself?

Rather than setting local/cross system there’s pkgsCross.aarch64-multiplatform.gcc that’s already cached. I’m not 100% sure what the differences are though.

Seems like these packages are cached for cross: https://hydra.nixos.org/jobset/nixpkgs/cross-trunk#tabs-jobs

Ah, thanks. For some reason I had the weird idea that pkgsCross was channels-specific… but yeah that’s nonsense, it gets passed in when you do a pkgs.callPackage.

Now, am I getting a cache hit? I think so…

bj ~/src/limmat-kernel-nix (master|↑1|✚1…4)   6s
❯❯  nix path-info --store https://cache.nixos.org -r /nix/store/am0dgdvqhzraycpy6fmyc080pzhljdbh-aarch64-unknown-linux-gnu-gcc-14.3.0
/nix/store/agrz08rwd77pl69668ya8qkxakrmiqxy-libgcc-aarch64-unknown-linux-gnu-14.3.0
/nix/store/dmmzzfpnwis83x3xyk1ib2sg3yyki7f9-glibc-aarch64-unknown-linux-gnu-2.40-218
/nix/store/08ss95mig8hxgv26m0dca4afzwfb2p89-glibc-aarch64-unknown-linux-gnu-2.40-218-bin
/nix/store/p98zvq4nb98krxcv7ss2zr1qngfmi0f5-gcc-14.3.0-libgcc
/nix/store/2a3izq4hffdd9r9gb2w6q2ibdc86kss6-xgcc-14.3.0-libgcc
/nix/store/3rkccxj7vi0p2a0d48c4a4z2vv2cni88-libunistring-1.4.1
/nix/store/hxcmad417fd8ql9ylx96xpak7da06yiv-libidn2-2.3.8
/nix/store/vr7ds8vwbl2fz7pr221d5y0f8n9a5wda-glibc-2.40-218
/nix/store/0p8b2lqk47fvxm9hc6c8mnln5l8x51q1-gcc-14.3.0-lib
/nix/store/0y221n4x5cwrig34sq4i40n3lls0m2ac-attr-2.5.2
/nix/store/82naasl2p0mwk3l0d74gvcnzgisbvgsp-gmp-with-cxx-6.3.0
/nix/store/avk494dnlxiyx1icqgmzbzga26hw9l7w-acl-2.3.2
/nix/store/48nhpn1dv5pn74018agdz7qrbiik2sd5-coreutils-9.8
/nix/store/dddpl9qjzndj29p0ph75wcxcb0a2vzhb-expand-response-params
/nix/store/fwr62xmh06l8y8zfgc5m18pfap9b8az0-bash-5.3p3
/nix/store/j9xn44l602gqphaag8c4r20wlqjqhvsb-linux-headers-6.16.7
/nix/store/p43pbi1nm52b7zhnpiw6gk9spc17zyj4-glibc-aarch64-unknown-linux-gnu-2.40-218-dev
/nix/store/xdxxfabbd8w0dadijsd8rkgvnhpn3rkf-zlib-1.3.1
/nix/store/ql83snddq461fmwmlq211hp8zrc8zasc-aarch64-unknown-linux-gnu-binutils-2.44
/nix/store/4rn0phcd1ycmzmlpb1wg889rh9yjfp5v-aarch64-unknown-linux-gnu-binutils-wrapper-2.44
/nix/store/ffrkxkxh9aj4k215qbyi64vwk75nqmlp-gmp-with-cxx-6.3.0
/nix/store/v69m5shgjnfmk4pwqzmrrviacp3dp090-mpfr-4.2.2
/nix/store/aaxj0fjnmjg87h7vwll9dsxljs8ij569-libmpc-1.3.1
/nix/store/bri1vmqmk3kfnj1w2miq6jmcjf8y76kv-isl-0.20
/nix/store/pnla0j7a2x52h3bw9nnq7d1qakar7jv6-aarch64-unknown-linux-gnu-gcc-14.3.0-lib
/nix/store/am0dgdvqhzraycpy6fmyc080pzhljdbh-aarch64-unknown-linux-gnu-gcc-14.3.0

pkgsCross doesn’t do anything but call nixpkgs with a specific crossSystem, so in either case it should be cached.

1 Like

“Should be” but isn’t. Just sharing what little I know.