5.10 Build helpers: runCommand, writeShellApplication, and symlinkJoin
Lesson 39 of 68 · 17:52
Up next in 5s…
About this lesson
Sometimes a package is just one command that turns an input file into an output file, and writing full phase boilerplate for that would be silly. This lesson covers the nixpkgs build helpers worth using every week: runCommand, writeShellApplication, symlinkJoin, and Python environments in mkShell. All of them are small wrappers around mkDerivation that shrink everyday tasks to a few lines.
In this video
- A dev shell that mixes three different Python versions, each tool wrapped to run on its own interpreter
python3.withPackages: interpreter plus libraries in one step, no venv, no piprunCommand: a complete package from a single shell snippet, demonstrated on a cowsay template gallery that stands in for real config and code generationwriteShellApplication: turning a bash snippet into a pinned, shellcheck-linted application that runs the same on every colleague's machinesymlinkJoin: merging many packages into one tree, plus a hashes.txt trick that administrators love for download servers
After this lesson
You can generate files, bundle scripts, and compose package trees with a few lines each, the glue work that makes Nix useful far beyond compiling software, especially for DevOps and admin tasks.
Builds on: Minimal mkDerivation (5.2)
Links: