Skip to content


Configure a shell with development tools

Given a project named proj with a pkgs/proj/default.nix file, create a file shells/proj-shell/default.nix that looks like this:

  proj, # (1)!
  # Add development tools here
  rust-analyzer, # (2)!
mkShell {
  inputsFrom = [
    proj # (3)!
  packages = [
    rust-analyzer # (4)!
  RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; # (5)!
  1. You must include the package as an input so that you can later extract the build inputs from it.
  2. Add any development tools you want as inputs. Here we use rust-analyzer and clippy so that you can use these from your IDE in the flox environment. If you wanted to add other development tools like Cargo subcommands, you would add those here as well. Note the commas after each item!
  3. inputsFrom will extract any necessary build inputs from the definition of the package so that you don't need to repeat them in this file.
  4. Add the development tools that you listed in the inputs here. Note that you shouldn't add commas between items here.
  5. Set this environment variable so that rust-analyzer can provide type definitions, autocomplete, etc for items in the Rust standard library.

To enter the shell, use the [flox develop][flox_develop] command and select proj-shell:

$ flox develop
Select package for flox develop
> proj-shell

You should now have access to development tools in your shell, and an editor launched from this shell should have access to rust-analyzer and clippy.