Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding RUST_SRC_PATH #5

Closed
oppiliappan opened this issue Apr 12, 2021 · 1 comment
Closed

Regarding RUST_SRC_PATH #5

oppiliappan opened this issue Apr 12, 2021 · 1 comment

Comments

@oppiliappan
Copy link

# FIXME: Is this correct? Should it use rust-overlay instead?
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";

This would work in most cases, but ideally, the rust-src component is on par with the active rustc toolchain (that is how rustup does it).

I source the rust-src component from mozillapkgs and export RUST_SRC_PATH like so (I think oxalica/rust-overlay also exposes the same rust-src component through rust-bin.<channel>.latest.rust-src):

RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";

RUST_SRC_PATH should contain the following:

alloc/        panic_unwind/       rustc-std-workspace-alloc/  stdarch/
backtrace/    proc_macro/         rustc-std-workspace-core/   term/
core/         profiler_builtins/  rustc-std-workspace-std/    test/
panic_abort/  rtstartup/          std/                        unwind/

There has been some discussion about providing rust-src from the nix store and rust-analyzer (rust-analyzer tries to write a Cargo.lock to the nix store and fails) but I have had no trouble with this.

I use this in my rust + nix flake setup (which has been modified heavily based on your template, thanks for that).

@srid
Copy link
Owner

srid commented Apr 13, 2021

Thanks for the info! Done in 0de7a6e

@srid srid closed this as completed Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants