How to get RV32 cross compiler + newlib-nano to work?

I’ll preface this by saying I’m a complete nix beginner.

One friend told me about Nix and NixOS and I really liked the idea so I decided to install it on a live USB and really enjoyed it, prompting me to boot it up permanently and daily drive it for the past ~2 weeks to see what it’s all about, I tried to dive deep in with flakes and home manager to configure different development environments (one for EDA with Quartus, Questa, Verilator, etc, one for normal work in C, C++ and python, one for RISCV64 cross compiling (this one is working so far!)) but I can’t get another one of them to work.

What I was trying to do specifically is: set up a devShell to cross-compile C for 32-bit RISC-V targeting rv32im with the soft-float ABI (ilp32). When linking my code (which uses newlib functions like printf and malloc), the build fails with an ABI mismatch error (can’t link double-float modules with soft-float modules) because the runtime libraries (libgcc.a and libc.a) supplied by pkgsCross.riscv32embedded are pre-compiled for hard-float (ilp32d). Overriding crossSystem in nixpkgs with arch = “rv32im” and abi = “ilp32” resolves the ABI conflict conceptually, but triggers a lengthy local source build of the entire GCC + Newlib toolchain that apparently freezes (?). Is there an existing pre-built or multilib bare-metal RISC-V toolchain package in nixpkgs for ilp32 soft-float, or a standard way to avoid rebuilding GCC from source for this target?

The cross compiler I’m trying to replicate and used on Debian can be found here.

The options so far seem to be:

  1. Create a Debian distrobox container with podman or a Debian VM

  2. Abandon NixOS, switch to Debian, Arch, somewhere this compiler is available but install Nix there to keep learning and playing with Nix.

BTW: I also tried to use a buildFHS to copy exactly what they are doing in Memphis-V but it got overcomplicated too fast.