devshell: fix usage with non-nix rust-analyzer
rust-analyzer binaries that don't come from nix (such as the one shipped with vscode's rust-analyzer extension by default) need the `RUST_SRC_PATH` env var to be the path to rustc's sources, but this wasn't set inside the devshell. this change explicitely adds it to the environment. (trying to add pkgs.rustLibSrc and rustcSrc to the shell's packages unfortunately does nothing, because they are just pure source packages, nothing more.) (the reason this probably didn't come up for other devs is because 1. a lot of lix devs use other editors that probably just use the binary from the path, and the devshell installs pkgs.rust-analyzer, which is patched to always have `RUST_SRC_PATH` set, and 2. because pkgs.vscode-extensions.rust-lang.rust-analyzer is also patched to use pkgs.rust-analyzer by default instead of the bundled one, so installing the extension using nix instead of from the marketplace would also hide this problem.) Change-Id: Ia27daf2a88756311ac5485ea0af44aae242241a9
This commit is contained in:
+4
-3
@@ -833,7 +833,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
inputsFrom = [ finalAttrs.finalPackage ];
|
||||
|
||||
# For Meson to find Boost.
|
||||
env = finalAttrs.env;
|
||||
env = finalAttrs.env // {
|
||||
# for non-nixpkgs rust-analyzer binaries, we need to epxlicitely set RUST_SRC_PATH
|
||||
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
|
||||
};
|
||||
|
||||
mesonFlags =
|
||||
# I guess this is necessary because mesonFlags to mkDerivation doesn't propagate in inputsFrom,
|
||||
@@ -890,8 +893,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
rustPlatform.rustLibSrc
|
||||
rustPlatform.rustcSrc
|
||||
]
|
||||
++ lib.optionals stdenv.cc.isClang [
|
||||
# Required for clang-tidy checks.
|
||||
|
||||
Reference in New Issue
Block a user