nix3-develop
Enter a development environment defined by Nix
TLDR
Start a shell with all dependencies of a package from nixpkgs available
Start a development shell for the default package in a flake in the current directory
In that shell, configure and build the sources
SYNOPSIS
nix3 develop [options...] [flake-ref]#[devShell-attr]
PARAMETERS
-c, --command cmd
Execute cmd in the dev shell instead of interactive shell
--expr
Treat flake input as Nix expression, not file
--flake url
Select flake from specified URL
--impure
Allow access to host environment (unpure)
--ignore-environment
Clear existing env vars before sourcing shell
-i
Alias for --impure
--keep-going
Continue on build errors
--no-use-remote
Build locally, skip remote cache
--no-write-lock-file
Skip updating flake.lock
--override-input input flake-ref
Override input with another flake
--profile path
Use custom profile for GC root
DESCRIPTION
The nix3 develop (or nix develop in Nix 3.x) command launches an interactive shell with a build environment defined by a Nix flake's devShell output. Flakes provide reproducible, declarative project configurations, specifying inputs (dependencies) and outputs like development shells.
Upon invocation, Nix evaluates the flake, builds the shell derivation (if needed), and sources its setup hook into the current shell. This configures PATH, environment variables, and other necessities for development tasks, such as compiling code or running tests. The environment is isolated yet allows overriding for flexibility.
Key benefits include reproducibility across systems, easy dependency management without global installs, and integration with tools like direnv via shell hooks. It's ideal for Rust, Haskell, or any language supported by Nix packages. Impure mode permits using the host environment alongside the flake shell.
Exiting the shell returns to the parent environment, leaving no persistent changes.
CAVEATS
Experimental in Nix <3.0; requires flakes enabled. Multi-flake support limited; impure mode reduces reproducibility. Large shells may build slowly without cache.
EXAMPLES
nix3 develop .#shell
nix3 develop github:NixOS/nixpkgs/nixos-unstable#gnumake
nix3 develop --impure -c cargo test
FLAKE INTEGRATION
Define in flake.nix: outputs = { self, nixpkgs }: { devShell.x86_64-linux = ...; };
HISTORY
Introduced experimentally in Nix 2.4 (2021) with flakes feature flag. Stabilized in Nix 3.0 (2023) as core CLI replacing nix-shell --pure. Evolved for better DX in monorepos and teams.


