Closed wmertens closed 10 months ago
I tried using fromRustupToolchainFile for rust-bin, but cargo etc still use the latest nightly.
Please paste the Nix code you are using, and how you enter the development environment for cargo.
Here's my flake.nix:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, rust-overlay, nixpkgs }:
let
b = builtins;
devShell = system: _pkgs:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
{
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
bashInteractive
gitMinimal
nodejs_20
# Qwik optimizer deps
cargo
clippy
wasm-pack
((rust-bin.fromRustupToolchainFile
./rust-toolchain).override {
targets = [ "wasm32-unknown-unknown" ];
})
];
};
};
in
{
devShells = b.mapAttrs (devShell) nixpkgs.legacyPackages;
};
}
As you can see I only get the rustc from the toolchain file, I can't figure out how to get the rest
nativeBuildInputs = with pkgs; [ bashInteractive gitMinimal nodejs_20 # Qwik optimizer deps cargo clippy wasm-pack ((rust-bin.fromRustupToolchainFile ./rust-toolchain).override { targets = [ "wasm32-unknown-unknown" ]; }) ];
You have cargo
explicitly listed here, which is picked from pkgs
and overrides the cargo
from fromRustupToolchainFile
. Please remove the cargo
line.
That did the trick thank you :pray::pray::pray:
I tried using fromRustupToolchainFile for rust-bin, but cargo etc still use the latest nightly.
How can I make sure that all the tools use the same rust version from the toolchain file?