2.2 The Nix REPL as a power tool
Lesson 9 of 68 · 9:55
Up next in 5s…
About this lesson
The Nix REPL is the fastest way to test a Nix expression before it ends up buried in a thousand line file. This Nix REPL tutorial shows how to evaluate code interactively, read documentation without opening a browser, and inspect, build and even patch packages from nixpkgs, all from one prompt.
In this video
- Starting
nix repl, evaluating expressions, and reading built-in docs with:docand tab completion - Loading all of nixpkgs with
nix repl --fileand using tab completion as a quick package search - Inspecting package metadata: description, home page, license, and what the
...in the output hints at - Building a package with
:band dropping into its shell with:u, straight from the REPL - A live demo: patching GNU hello so it prints a different greeting, without editing a single file
After this lesson
You keep a REPL open next to your editor and test every idea there first, which saves you from writing Nix code that never had a chance to work.