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

5.9 Language-specific builders: Python, Go, and Rust with Nix

Lesson 38 of 68 · 8:01

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

Nobody packages a Python, Go, or Rust project with raw mkDerivation. nixpkgs ships around 50 language specific builders for that, and they all follow one pattern. This lesson walks through buildPythonPackage, buildGoModule, and buildRustPackage so that the wall of text in the nixpkgs manual turns into a quick reference you can apply to any tech stack in minutes.

In this video

  • Where language support lives in the nixpkgs manual, and how to get productive from a few pages of it
  • buildPythonPackage with fetchPypi, pname and version, and the one default that is the opposite of plain mkDerivation
  • The finalAttrs pattern: why these examples avoid rec, and how a package can react to future overrides of itself
  • buildGoModule and its vendorHash: what setting it to null means, and the fake hash trick for filling it in
  • buildRustPackage and the lock file that lets Nix synthesize every dependency download as a fixed output derivation

After this lesson

When someone hands you a project in a language you have never packaged, you know which builder to reach for, how its fetcher and hash fit together, and which manual chapter covers the rest.

Links: