Nix 101 Course / Section 4: How Nix actually builds: sandbox → derivation → hash → store
Premium

4.2 Inside the Nix build sandbox

Lesson 25 of 68 · 28:38

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

Every Nix build runs in a sealed off mini world: no internet, no home folder, almost no files. In this lesson we break into that world and look around. Afterwards you know why "works on my machine" problems cannot happen with Nix.

In this video

  • Building the smallest possible derivation: four parameters and one shell script
  • The environment inside the sandbox: a handful of variables with strange values like HOME=/homeless-shelter, and why that is a feature
  • A tour of the sandbox file system: what is in /bin, /dev, /proc and /etc, and what is missing
  • Watching internet access fail on purpose, and what that buys you
  • The contract between Nix and your build script, and the one variable everything depends on

After this lesson

When a real build fails later, you know exactly what world it failed in. This is the lesson that turns build debugging from guessing into inspection.