Nix-shell with rustup


Lately I’ve been using rustup (installed outside of nix-shell).
This is due to a couple of reasons: Ubuntu 21.10 "Can not attach stdlib sources automatically" · Issue #8364 · intellij-rust/intellij-rust · GitHub (intellij-rust requires the rust sources to be rw) and also cargo likes to default its binaries to $USER/.cargo/bin which breaks some stuff.

Anyway, using rustup seemed to work fine on my main system, however, seems I get issues on another one:

error: /lib/x86_64-linux-gnu/ version `GLIBC_2.32' not found (required by /root/git/controller/target/debug/deps/

Not exactly sure what’s going on but it seems that for some reason the compiler from rustup ends up using the system’s libc rather than the one from the nix-shell and they are not the same version (2.32 vs 2.34).

Is there any nice way around this?

Thank you!

Seems related to How to **not** use libs from nix - #4 by symphorien maybe

Also did you install nixpkgs’s rustup in the past, then uninstalled it, and installed the official rustup afterwards without nuking .rustup in-between ?

It seems so, but it’s not the same situation here, it’s a brand new ubuntu system.