Jump to the navigation menu

Building fonts with Nix

I recently started using Nix to build my PDF presentation slides that I create with rst2pdf.

I removed the custom build script that was generating the PDF files and moved that code into a Nix derivation.

Now I can run nix build .#test-driven-drupal and it will generate the slides for that talk.

As well as the files specific to each presentation, I also have a derivation for shared assets that apply to all talks - i.e. the stylesheets and fonts that are embedded within the PDF.

The font files were stored in the repository but I wanted to remove them and use the font files available in nixpkgs.

After some small changes, I was able to do it and remove the font files from my repository.

The Inter font is available in nixpkgs, but it downloads an InterVariable.ttf font that rst2pdf didn't know how to change the font weight for, so I made my own derivation of the static Inter font based on the releases from GitHub.

I'm happy that I was able to achieve this, as my repository is leaner and I'm continuing to find new and interesting uses for Nix in my workflows.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an certified Drupal Triple Expert with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.