7.2 makeWrapper: your own preconfigured version of any program
Lesson 48 of 68 · 14:07
Up next in 5s…
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
vimwith its own name, flags, and bundled config, installable withnix profile - A
psqlwrapper that sets database defaults, prepends extra tools toPATH, and inserts flags before and after the user's own arguments - Where
makeWrapperis 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)