Skip to content

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):

experimental-features = nix-command flakes

After restarting the daemon or opening a new shell, flake commands work (Nix 2.34.x; nix flake still prints the experimental-interface warning):

nix flake init
nix build .
nix run nixpkgs#hello

One-off enablement without editing nix.conf:

nix --extra-experimental-features 'nix-command flakes' flake metadata .

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

See also