Using Rust in nix-shell: mkDerivation or mkShell?

I’m updating the nixpkgs Rust language section and have noticed most snippets in the manual use stdenv.mkDerivation.
But if you read the Rust wiki page most snippets advocate using mkShell.

What are the tradeoffs to using each for ephemeral development environments?

Without knowing how they work under the hood, I lean toward mkShell because it seems more intuitive.

For ephemeral environments mkShell is probably easier to use, as it is meant to be used just for this.

If you though have something you want to build and want to derive an exact build environment without any extras from it, then use mkDerivation to build the final package and get the Dev env for free from it.

1 Like