Skip to content

Commit 9a32328

Browse files
committed
flake: Ensure correct stdlib lookup in devShell
Without this patch rust-analyzer has problems looking up the correct standard library sources when they don't match the environment.
1 parent 95f5dbf commit 9a32328

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

flake.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
pname = "tytanic";
5050
version = cargoToml.workspace.package.version;
5151

52-
rust-toolchain = (fenix.packages.${system}.fromManifestFile rust-manifest).defaultToolchain;
52+
rust-toolchain = fenix.packages.${system}.fromManifestFile rust-manifest;
5353

5454
# Crane-based Nix flake configuration.
5555
# Based on https://github.com/ipetkov/crane/blob/master/examples/trunk-workspace/flake.nix
56-
craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain;
56+
craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain.defaultToolchain;
5757

5858
# Tytanic files to include in the derivation.
5959
# Here we include Rust files.
@@ -145,9 +145,12 @@
145145
checks = self'.checks;
146146
inputsFrom = [ tytanic ];
147147

148-
buildInputs = with pkgs; [
149-
rust-analyzer
148+
buildInputs = [
149+
rust-toolchain.rust-analyzer
150+
rust-toolchain.rust-src
150151
];
152+
153+
RUST_SRC_PATH = "${rust-toolchain.rust-src}/lib/rustlib/src/rust/library";
151154
};
152155
};
153156
};

0 commit comments

Comments
 (0)