Cross compiling Rust for Raspberry pi

I’m trying to compile an iced-rs based application for a raspberry pi 3 from my x86 nixos 22.11, but at this point I’d be happy with compiling an “hello world”.

The following shell.nix is my attempt that makes the most sense to me:

let
  pkgs = import <nixpkgs> {
    crossSystem = {
      config = "armv7l-unknown-linux-gnueabihf";
    };
    overlays = [
      (import (fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
    ];
  };
in 
  with pkgs;
  stdenv.mkDerivation {
    name = "oxalica_overlay_shell";
    nativeBuildInputs = [
      (rust-bin.stable.latest.default.override {
        targets = [ 
          "x86_64-unknown-linux-gnu"
          "arm-unknown-linux-gnueabihf" 
        ];
      })
    ];
  }

But when I start the shell I’m getting

       > error: auto-patchelf could not satisfy dependency libgcc_s.so.1 wanted by /nix/store/p8bkvn7x66jpvy9fqw52jb9gn6x0qd5p-rust-std-1.67.1-arm-unknown-linux-gnueabihf/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libstd-0e3c9543c833e345.so
       > error: auto-patchelf could not satisfy dependency libgcc_s.so.1 wanted by /nix/store/p8bkvn7x66jpvy9fqw52jb9gn6x0qd5p-rust-std-1.67.1-arm-unknown-linux-gnueabihf/lib/rustlib/arm-unknown-linux-gnueabihf/lib/libtest-5f9a572bb4066d2a.so
       > auto-patchelf failed to find all the required dependencies.

Any idea?

2 Likes