Skip to content
Technical Difficulty: Hard

Reproducible Chaos: Why I Switched to Nix Flakes

#Nix#DevOps#Reproducibility

Introduction

"It works on my machine."

This sentence is the tombstone of productivity. It is the lie we tell ourselves when a new hire spends three days trying to get the backend running because they have postgres version 15 installed via Homebrew, but the project requires version 14.

We fixed deployment with Docker. We containerized production. But local development? It’s still the Wild West. We rely on README.md files that are six months out of date, nvm commands we forget to run, and the hope that brew upgrade doesn't break our entire Python environment.

The Solution: Nix Flakes

Nix Flakes are the "package.json" for your entire OS. They allow you to define exactly what binaries, compilers, and tools your project needs, pinned to the exact git commit hash.

Imagine this:

  1. You cd into a project directory.
  2. Your prompt changes.
  3. Suddenly, node is version 20.11.0. postgres is 14.2. cargo is available.
  4. You cd out. They are gone.

No docker-compose up. No nvm use. It just works.

Conclusion: Stop installing things globally

If you take one thing away from this article: Stop using brew install for project dependencies. Your project dependencies belong in your project, described by code, versioned by Git.