flakes¶
Overview¶
The flakes experimental feature flag enables Nix’s flake format and the nix flake subcommands. Flakes provide a standardized project entry point (flake.nix, flake.lock) and integrate with the Nix 3 CLI. The flag remains experimental as of Nix 2.34.x (stable manual 2.34.9 flakes entry; verified on 2.34.8): the interface can change in backwards-incompatible ways until stabilisation, even though flakes are widely used in practice for new projects.
Enabling flakes is almost always paired with nix-command. Schema, workflows, registries, and migration belong in Flakes—this page covers the flag, how to turn it on, and how it relates to other experimental features. For vocabulary before diving in, see Flake (concept).
Details¶
What the flag unlocks. With flakes enabled, Nix accepts flake references in commands such as nix build, nix run, and nix develop, and exposes nix flake for lockfile management, input updates, and inspection. The on-disk format and CLI behaviour are documented in the Nix manual — nix flake; the original design is RFC 49. Deep dive material lives under 07-flakes: flake.nix schema, inputs and outputs, lockfile, registries and refs, and workflows.
Experimental status. Like all flags listed under experimental features, flakes is disabled by default and must be opted into explicitly. Feature flags have existed since Nix 2.4; flakes is still listed as experimental in the 2.34.x series—do not assume stabilisation without release notes. Stabilisation progress is tracked on the flakes tracking milestone; see Tracking stabilization for the general lifecycle.
Relationship to fetch-tree. Enabling flakes also enables the fetch-tree built-in: the manual states that the flakes feature flag always enables fetch-tree. You can enable fetch-tree alone to try tree fetching in isolation, but full flake workflows require flakes.
Not covered here. Input/output schema, lockfile semantics, pure evaluation, and publishing flakes are documented under 07-flakes. For how experimental flags fit together, see Feature flags overview.
Examples¶
Add both flags to nix.conf (user or system):
After restarting the daemon or opening a new shell, flake commands work (Nix 2.34.x; nix flake still prints the experimental-interface warning):
One-off enablement without editing nix.conf:
Without flakes, the same invocations fail with (Nix 2.34.8):
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
References¶
- Nix manual — experimental features (
flakes, 2.34) — version-stamped flag entry (manual 2.34.9) - Nix manual — experimental features — flag lifecycle and current
flakesentry - Nix manual —
nix flake— flake format, inputs, outputs, and lock file - nix.dev — Flakes (concept) — high-level introduction
- RFC 49 — Flakes — original design specification
- flakes tracking milestone — stabilisation tracking on the Nix repository
See also¶
- nix-command — companion flag for Nix 3 subcommands
- Feature flags overview — enabling flags and full inventory
- Tracking stabilization — experimental → stable path
- flake.nix schema — outputs attrset and evaluation entry
- fetchTree and Git —
fetch-treebuilt-in (always enabled withflakes) - Experimental backlog — other experimental flags without wiki leaves