nix-community / lorri

Your project’s nix-env [maintainer=@Profpatsch,@nyarly]
Apache License 2.0
677 stars 24 forks source link

`RUST_SRC_PATH = "${pkgs.rustc.src}/lib/rustlib/src/rust/src/";` is wrong? #60

Open dpc opened 3 years ago

dpc commented 3 years ago

pkgs.rustc.src is a

/nix/store/wrxr7nvx9zkhs0sp8rna227n47hyc3fl-rustc-1.51.0-src.tar.gz: gzip compressed data, max compression, original size modulo 2^32 1051570176

rust-analyzer doesn't seem to work with it.

dpc commented 3 years ago

Or maybe rust-analyzer is supposed to handle tar.gz files? Well. In that case it doesn't work for me. I tried with mozilla overlay and standalone rust-src and it still doesn't work. Oh well.

dpc commented 3 years ago

I don't think it does since it tries to lookup the exact directory to check if it's valid https://github.com/rust-analyzer/rust-analyzer/commit/85db47ac76c383295caee0c1d4284544b761add9

dpc commented 3 years ago

After more digging it seems that the root cause is a need for more recnet rust-analyzer than what's available in nixpkgs.

Though that RUST_SRC_PATH indeed seems wrong, and rust-analyzer will just switch to use rustc --print sysroot to detect library source code instead.

symphorien commented 3 years ago

In recent versions of nixpkgs, rust-analyzer is wrapped to use the right value of this env var, so this could be removed.

dpc commented 3 years ago

@symphorien I'm not sure if I understand. The main problem that I've seen is that this env var points to a tar file, and rust-analyzer does not seem to support anything like this. I just wanted to point it out to potentially help , and if I'm just confused about something, feel free to close.

symphorien commented 3 years ago

I meant: rust-analyzer works fine if you remove the env var, because of https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/rust/rust-analyzer/wrapper.nix#L14 So I'm in favor of removing this env var.