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

5.2 A minimal mkDerivation: build GNU hello yourself

Lesson 31 of 68 · 2:26

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

Watching someone package software with Nix is one thing, typing the expression yourself is what makes it stick. In this short exercise you download the GNU hello tarball and write your own minimal stdenv.mkDerivation expression for it, this time pointing src straight at the archive instead of an unpacked folder. It is the quickest way to see how much mkDerivation figures out on its own.

In this video

  • Writing a complete package expression with little more than a name and a src
  • Pointing src at a tarball and watching the unpacking happen without one extra line of code
  • Why the exact same expression works for a folder and for an archive
  • A look ahead: how fetchers will later pin this download properly

After this lesson

You have packaged an upstream tarball with your own hands, and the basic mkDerivation pattern is in your muscle memory for everything that follows.

Links: