Intellij-rust & NixOS - invalid standard library


#1

Hi,

I’m using the Intellij-rust plugin with NixOS. I have tried to keep this simple and only installed the ‘rustc’, ‘cargo’ and ‘rust-src’ packages. I have configured the toolchain to point at /home/bruno/.nix-profile/bin but can’t manage to configure the standard library, I keep getting ‘cargo project update failed: invalid standard library’.
My project compiles but the plugin cannot help me with the standard library (autocomplete, navigation, …).

Perhaps @matklad can’t shine some light? :slight_smile:

Thanks,
Bruno


#2

Intelij-Rust works best with rustup, but, unfortunately, rustup does not work really great with NixOS :slight_smile:

For non-rustup toolchains, you need to provide the sources of the standard library yourself: just clone rust-lang/rust repository and than specify path to the src lib in the Settings > Langauges & Frameworks > Rust.


#3

Can confirm, this worked for me.

For the cargo toolchain setting, I selected ~/.nix-profile/bin (despite it beeing installed in nix-env but rather via configuration.nix).


#4

That works! Thanks for the quick answer! :slight_smile: