Script dependencies with Nix

by kqr, published 2026-10-22

Tags:

python-dependencies-with-nix.jpg

On the go? Listen to an ai-narrated version of this article.

Confused? More about ai narration.

In the theme of NixOS enabling fearlessness, here’s a way I use Nix on other Linux distributions to sleep better at night: managing dependencies of simple scripts.

This way of using Nix is for everyone, not just those willing to try NixOS. We’ll look at it first for a Python script, and then see how it can be adapted to any other language.

Managing script dependencies with Nix

I wanted to create a script that would read the verbatim content of my articles out loud to me with a synthesised voice.11 This is entirely separate from the recent ai narration experiment. Reading the article out loud is one of my self-editing steps, to detect flow problems and awkward phrasings. I’ve discovered that hearing someone else read the article is slightly more effective than reading it out loud myself, though both are useful. When I read it out loud myself, I tend to read what I intended to say, not the words that are actually on the page. One of the more convenient ways to do this is with Python, where I’ve heard good things about Trafilatura for extracting the contents out of a web page, filtering on types of content, etc.