9.2 Anatomy of a flake: inputs, outputs and the lock file
Lesson 60 of 68 · 16:15
Up next in 5s…
About this lesson
Every flake.nix file has the same skeleton: a description, flake inputs, and outputs. This lesson takes a minimal flake apart line by line, so flake.lock, legacyPackages and the packages.system.name attribute path stop being mysterious. Along the way you get the full CLI tour: nix build, nix run, nix develop, nix flake show and nix flake check.
In this video
- Why outputs are a function of inputs, and what the
flake.lockfile actually pins - The odd rule about architectures in
packages, and a two-line trick that supports every platform nixpkgs supports - Why nixpkgs hides its packages inside
legacyPackages, explored live in the REPL with:lf - What
defaultmeans fornix buildandnix run, and how a flake references itself throughself - Catching a broken output structure with
nix flake checkbefore anyone else has to tell you
After this lesson
You can read any flake.nix you find on GitHub, add a dev shell to one, and inspect a flake you never checked out using nix flake show.