From 0de7a6e480573d2d5397c136f56303ed588e4e98 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 13 Apr 2021 15:34:34 -0400 Subject: [PATCH] RUST_SRC_PATH should use the overlay Also install rust-analysis and rls via nix, so that the user doesn't need to rely on the VSCode extension to download a static binary. --- flake.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 16e29e3..5a094e3 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ let # If you change the name here, you must also do it in Cargo.toml name = "rust-nix-template"; + rustChannel = "stable"; in utils.lib.eachDefaultSystem (system: @@ -35,8 +36,8 @@ # Because rust-overlay bundles multiple rust packages into one # derivation, specify that mega-bundle here, so that crate2nix # will use them automatically. - rustc = self.rust-bin.stable.latest.default; - cargo = self.rust-bin.stable.latest.default; + rustc = self.rust-bin.${rustChannel}.latest.default; + cargo = self.rust-bin.${rustChannel}.latest.default; }) ]; }; @@ -87,9 +88,10 @@ [ nixpkgs-fmt cargo-watch + pkgs.rust-bin.${rustChannel}.latest.rust-analysis + pkgs.rust-bin.${rustChannel}.latest.rls ]); - # FIXME: Is this correct? Should it use rust-overlay instead? - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + RUST_SRC_PATH = "${pkgs.rust-bin.${rustChannel}.latest.rust-src}/lib/rustlib/src/rust/library"; }; } );