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

Video chapters

  1. 0:00 Introduction to makeWrapper
  2. 1:12 Fixing PlantUML on macOS
  3. 3:34 How makeWrapper builds command wrappers
  4. 6:29 Practical wrapper examples: Vim, SSH, and Postgres
  5. 11:10 Binary wrappers with makeBinaryWrapper
Transcript

Introduction to makeWrapper

0:00 So in this video, I want to show you an amazing tool that's called makeWrapper. And while it's kind of relatively abstract to explain what it does and when you would want to use it, I want to explain it with a lot of examples. The first example that I have is, for example, we once had a project where we were using MkDocs, that's a Python tool that can translate from Markdown to nice HTML documentation that you can browse.

0:31 And inside that, we integrated when you have this backtick, backtick, backtick syntax to have inline code examples in your pages, we used PlantUML graph descriptions. PlantUML is a Java tool that can transform from your graph description to nice and pretty graph diagrams and pictures. And of course, if you just embed that in Markdown, then you need additional plug-ins so that they recognize, ah, this code is a PlantUML diagram.

1:02 We run it through PlantUML. PlantUML, in turn, is a Java application. And we had the problem that when you were building your documentation on macOS,

The full transcript comes with the lesson.

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)