Nix 101 Course / Section 7: Advanced packaging topics
Premium

7.2 makeWrapper: your own preconfigured version of any program

Lesson 48 of 68 · 14:07

placeholder thumbnail

Sign in, then buy this course to watch

Free account · no credit card needed

About this lesson

Some programs are almost right: they just need one extra flag, one environment variable, or one config file preloaded every single time. makeWrapper builds a small wrapper around any executable so it always starts exactly the way you want, without patching or forking anything. This lesson teaches the tool through real examples, from taming a Java app on macOS to shipping a preconfigured vim, ssh, and psql to your whole team.

In this video

  • A real war story: a Java tool kept stealing window focus on macOS, and how a five minute wrapper around the JRE fixed it for a colleague who had never used Nix
  • Building a team vim with its own name, flags, and bundled config, installable with nix profile
  • A psql wrapper that sets database defaults, prepends extra tools to PATH, and inserts flags before and after the user's own arguments
  • Where makeWrapper is actually documented (hint: not in the manual you would expect)
  • makeBinaryWrapper: the same trick as a compiled C binary, for macOS and locked-down embedded systems that ship no shell at all

After this lesson

You can take any program from nixpkgs and turn it into a preconfigured team tool in a few lines, from company SSH setups to per-project editors.

Builds on: override vs overrideAttrs (6.4)