nix-command¶
Overview¶
The nix-command experimental feature enables the unified Nix 3 CLI: subcommands such as nix build, nix run, nix develop, nix eval, and nix flake under a single nix entry point. It replaces the classic tool split (nix-build, nix-shell, nix-env, and related scripts) with one command tree documented in the new CLI reference.
As of Nix 2.34.x (stable manual title 2.34.9; verified on 2.34.8), the feature remains experimental—subcommand names, flags, installable syntax, and output formats can change between releases. Do not treat it as stabilized unless release notes say so. Feature flags themselves date to Nix 2.4. Enable the flag in nix.conf or pass it per invocation; see Feature flags overview for the general mechanism.
Details¶
What it unlocks. With nix-command, the nix binary exposes the modern command surface: build and run derivations, enter dev shells, evaluate expressions, search and profile packages, copy store paths, and inspect store objects. Many subcommands share installables (flake refs, --file / --expr, store paths) plus common flags such as --json. Installables are themselves part of this unstable surface—see the manual warning on nix.
Not the same as flakes. nix-command does not enable flakes. Flake-oriented workflows—nix build ., nix flake show, registry refs like nixpkgs#hello—require both nix-command and flakes. You can use the new CLI without flakes via --file / --expr (and store paths). In practice both flags are enabled together on systems that follow current nix.dev guidance.
Relation to classic CLI. Classic commands remain available when Nix is installed; enabling nix-command does not remove them. New documentation and community examples increasingly assume the unified CLI. Command-by-command migration lives under CLI and tooling (classic vs modern).
Stabilization. Upstream tracks work under the nix-command stabilisation milestone (still open against Nix 2.34.x as of this pass). Related CLI review is discussed in the CLI stabilization effort. No invented stabilization date—follow release notes and that milestone; see Tracking stabilization.
Examples¶
Enable the feature for a one-shot evaluation (no flakes required). Verified with Nix 2.34.8:
With only nix-command, flake installables fail until flakes is also enabled:
nix --experimental-features 'nix-command' flake show
# error: experimental Nix feature 'flakes' is disabled; …
Typical persistent enablement (new CLI + flakes) in nix.conf:
Or on NixOS / Home Manager:
After that, common modern invocations work without extra flags:
References¶
- Nix manual —
nix-command(experimental features) — flag description (Nix 2.34.x / manual 2.34.9) - Nix manual —
nix(new CLI) — unified command reference and installables - nix-command stabilisation milestone — upstream tracking
- CLI stabilization effort — incremental CLI review notes
See also¶
- Feature flags overview — how experimental features are enabled
- flakes — companion feature for flake inputs, outputs, and lockfiles
- Tracking stabilization — experimental → stable path
- Modern CLI —
nix build/develop/runand related guides - Experimental backlog — other experimental flags without wiki leaves
- flake.nix schema — flake outputs when using both flags