5.2 A minimal mkDerivation: build GNU hello yourself
Lesson 31 of 68 · 2:26
Up next in 5s…
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
nameand asrc - Pointing
srcat 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:
- GNU hello 2.9 source tarball used in the video: https://gnu.mirror.constant.com/hello/hello-2.9.tar.gz
- https://nixos.org/nixpkgs/manual/#sec-using-stdenv