From 9daae17b8eaf24a7eeb89c040c9a221ea90a415d Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 8 Feb 2024 15:45:59 -0800 Subject: [PATCH] [nix flake] add `rust-src` component 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. --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 408dff5706..8897d9428d 100644 --- a/flake.nix +++ b/flake.nix @@ -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