How can I set up my Rust programming environment?

For development I mostly use a shell.nix with the Rust toolchain. I use Mozilla’s Rust overlay because it makes it so easy to get the current stable versions, nightlies, or even specific nightlies (for pyo3). E.g.

with import <nixpkgs> {};

stdenv.mkDerivation rec {
  name = "finalfusion-utils-env";
  env = buildEnv { name = name; paths = buildInputs; };

  buildInputs = [
    latest.rustChannels.stable.rust
}

To make something properly buildable, I add default.nix using crate2nix + buildRustCrate or buildRustPackage.

3 Likes