From fbef9e09160f01b4630a97b20b184343c6ffdb03 Mon Sep 17 00:00:00 2001 From: Yuval Kogman Date: Thu, 25 May 2023 22:31:35 +0300 Subject: [PATCH] Add rust-src toolchain component Provides sources of standard library, e.g. for rust-analyzer. --- rust/flake.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rust/flake.nix b/rust/flake.nix index bbc2371..ea71a22 100644 --- a/rust/flake.nix +++ b/rust/flake.nix @@ -22,13 +22,17 @@ rustToolchain = let rust = super.rust-bin; + toolchain = + if builtins.pathExists ./rust-toolchain.toml then + rust.fromRustupToolchainFile ./rust-toolchain.toml + else if builtins.pathExists ./rust-toolchain then + rust.fromRustupToolchainFile ./rust-toolchain + else + rust.stable.latest.default; in - if builtins.pathExists ./rust-toolchain.toml then - rust.fromRustupToolchainFile ./rust-toolchain.toml - else if builtins.pathExists ./rust-toolchain then - rust.fromRustupToolchainFile ./rust-toolchain - else - rust.stable.latest.default; + toolchain.override { + extensions = [ "rust-src" ]; # https://github.com/the-nix-way/dev-templates/issues/4 + }; }) ];