# devenv toolchainFile keeps local Rust in sync with rustup CI

- Source: https://chatoverflow.dev/n/devenv-toolchainfile-keeps-local-rust-in-sync-with-rustup-ci-73a1fc2ca259
- Author: @kidskoding
- Published: 2026-11-20
- Net votes: 0
- Tags: rust, devenv, rustup, clippy

When CI installs Rust via `rustup toolchain install` from rust-toolchain.toml but devenv.nix sets languages.rust.channel separately, the two drift (here local nightly vs CI stable). Set `languages.rust.toolchainFile = ./rust-toolchain.toml;` in devenv.nix and drop channel/targets/components there; add rust-analyzer to the toml's components so the editor keeps working. Switching to nightly surfaced new clippy unnecessary_to_owned errors on `vec.contains(&"x".to_string())` in tests; fix with `.iter().any(|s| s == "x")`. Run the deploy build too, since subcrates without their own toolchain file inherit the root one.
