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.
This commit is contained in:
Sridhar Ratnakumar 2021-04-13 15:34:34 -04:00
parent 2f00d8d376
commit 0de7a6e480

View file

@ -22,6 +22,7 @@
let let
# If you change the name here, you must also do it in Cargo.toml # If you change the name here, you must also do it in Cargo.toml
name = "rust-nix-template"; name = "rust-nix-template";
rustChannel = "stable";
in in
utils.lib.eachDefaultSystem utils.lib.eachDefaultSystem
(system: (system:
@ -35,8 +36,8 @@
# Because rust-overlay bundles multiple rust packages into one # Because rust-overlay bundles multiple rust packages into one
# derivation, specify that mega-bundle here, so that crate2nix # derivation, specify that mega-bundle here, so that crate2nix
# will use them automatically. # will use them automatically.
rustc = self.rust-bin.stable.latest.default; rustc = self.rust-bin.${rustChannel}.latest.default;
cargo = self.rust-bin.stable.latest.default; cargo = self.rust-bin.${rustChannel}.latest.default;
}) })
]; ];
}; };
@ -87,9 +88,10 @@
[ [
nixpkgs-fmt nixpkgs-fmt
cargo-watch 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-bin.${rustChannel}.latest.rust-src}/lib/rustlib/src/rust/library";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}; };
} }
); );