Nix 101 Course / Section 5: Packaging real software with stdenv.mkDerivation
Premium

5.3 What stdenv ships: default tools, buildInputs, and nativeBuildInputs

Lesson 32 of 68 · 8:14

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

You never listed gcc, make, bash, or tar in your package, yet the build worked. This lesson shows what the Nix standard environment (stdenv) ships out of the box, and which mkDerivation parameters add the dependencies it does not include. You also learn the difference between buildInputs and nativeBuildInputs, a distinction many packages in the wild get wrong.

In this video

  • The exact toolset inside every stdenv sandbox: shell, compiler, coreutils, patching and unpacking tools
  • Why Linux and macOS builds get different C compilers
  • buildInputs vs nativeBuildInputs: where libraries like OpenSSL go, where build tools like CMake go, and why mixing them up bites you later during cross-compilation
  • Packages that forget their own dependencies (scripting languages, this one is about you), and the parameter that fixes it
  • Finding the dependency chapter in the nixpkgs manual, and why Google will not find it for you

After this lesson

You know what is already in the sandbox before your build starts, and you can add a library or a build tool to a package without guessing which parameter it belongs in.

Links: