Today I’m happy to release s new tool I’ve been working on: njk. njk is a small (less than a megabyte!) self-contained binary which provides a powerful templating language for use in container setups.
Let me tell you a story.
A few years ago, when I started working on the Docker setup for Jitsi Meet, I needed some tool to generate configuration files from environment variables. I was familiar with Jinja2, but adding Python with the Jinja2 package didn’t feel quite right so I started looking for alternatives.
The search quickly took me to the Go ecosystem, since not only lots of single-purpose utilities are written in Go, it has a nice builtin templating package too. I found a utility called frep which did exactly what I needed: a single binary with no dependencies which I could use to create configuration files from environment variables.
Problem solved, right? Sure… but ever since I discovered frep I wanted to do something similar, but more of my own. I didn’t give it much thought until I ran into Nunjucks.
That worked, otherwise the title of this post would’ve been different, of course 🙂 What really surprised me was how small the resulting binary is! When built for small size (-Os) it’s around 800K. Not bad! If you are curious, check it on GitHub!