Nix 101 Course / Section 2: The Nix language
Premium

2.3 Nix syntax: the complete tour

Lesson 10 of 68 · 40:38

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

One video, the whole Nix syntax. This Nix language tutorial covers attribute sets, functions, let and in blocks, string interpolation and imports, plus the constructs you should recognize but avoid. After it, real world Nix code stops looking cryptic.

In this video

  • Attribute sets, inherit, the ? test and the or fallback operator (no, inherit has nothing to do with object orientation)
  • Functions, currying and partial application, explained side by side with Python lambdas
  • Attribute set parameters with default values, the ... ellipsis, and one @ pattern that is a genuine anti-pattern
  • Scoping with let and in, and the with construct with its variable shadowing trap
  • Multi-line strings and interpolation, merging sets with // and its surprise on nested sets, and importing Nix files

After this lesson

You can read almost any Nix expression in the wild, and you know which constructs are good style and which ones will hurt the next reader.