Skip to content

Commit

Permalink
[nix flake] add rust-src component
Browse files Browse the repository at this point in the history
Currently, when using the Nix flake managed Rust toolchain,
`rust-analyzer` complains that it can't expand proc macros, because it
can't find the sysroot. Adding the `rust-src` Rustup component fixes
this. This PR adds the `rust-src` component to the flake's Rust
toolchain.
  • Loading branch information
hawkw committed Feb 8, 2024
1 parent dcbc9cb commit 9daae17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
system = "x86_64-linux";
};
# use the Rust toolchain defined in the `rust-toolchain.toml` file.
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rustToolchain = (pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
extensions = [
"rust-src" # for rust-analyzer
];
};

buildInputs = with pkgs; [
# libs
Expand Down

0 comments on commit 9daae17

Please sign in to comment.