What does Nix see when it reads a shell.nix?
Expressions, the sixth free Part of LabCraft's Nix course, is now available. It opens right after First Contact and takes you from single values to reading a real shell.nix the way the evaluator does.


Type 7 / 2 into nix repl and you get 3. Drop the spaces and you get
/home/learner/7/2.
Nothing is wrong with the REPL. Nix read a different expression than the one you meant, and it handed back the exact value of what it read. That gap, between the expression you intended and the one Nix parsed, is what this Part trains you to see, and the judgment is in seeing it before you run anything.
Expressions is the new free Part of LabCraft's Nix course. The first command
in the course, nix shell nixpkgs#jq, already evaluated a Nix expression you
never saw. Across seven hands-on labs on a real NixOS machine, you work through
that language directly: values, strings, lists and attribute sets, let and
if, functions, and import. Every lab has you break something on purpose
before you rely on it.
The questions come first
The labs pose the language as questions you answer against a real evaluator. Why
is a-b an undefined variable instead of a subtraction? Why does an if with
no else fail before Nix evaluates anything? Why does nix eval --expr refuse
a file sitting in your own home directory? Each answer comes from an error you
caused, read, and fixed.
It ends on a real shell.nix
The last lab stages the kind of shell.nix you would find at the top of a
repository. You read it line by line, predict the name of the shell it
describes, then ask Nix. Evaluating that one attribute builds nothing, so the
only thing under test is your reading.
Why it opens early
Expressions sits beside Store Paths in the course graph: both need only First Contact. You can take the language before the store Parts, after them, or alongside them.
Start the Nix course. Predict what Nix will print before it prints it.