One of the big new concepts in Nix is the flake
, which is a new standard
format for nix projects to declare all their outputs. At the beginning of
this series, I mentioned them as being one of the major components of modern
Nix, and now this series has introduced enough of a foundation it's time
to explain flakes themselves.
What is a flake?
A flake
is a standard format for describing a collection of Nix resources.
These resources can be packages, of the type described in previous posts,
intended to be used to install some software to your system. There's also a
number of other types of resources that can be exposed by the flake which
we'll cover in later posts. Some examples of these are:
- developer environment descriptions
- modules for configuring NixOS systems
- runnable commands
By standardising a format to list all these outputs (compared to the ad-hoc
files this series has been using until now), Nix allows a number of higher level
tools to operate on these resources, like the nix profile install
and nix run
commands that have been shown in earlier parts.
Finally, the development of the flake based tooling allowed the Nix team
to resolve some pain points with the older generation of tooling, such
as making the process of recording versions for reproducibility more ergonomic with
lock files, or making better ways to identify newer versions of the same
package to allow tools to manage updates.
Start learning about Flakes