Find Related products on Amazon

Shop on Amazon

Nix Derivations, Without Guessing

Published on: 2025-05-02 23:25:13

I went on a little low-level Nix adventure yesterday and early this morning because of this excellent blog post. In it, Farid builds up the simplest possible Nix derivation—making a file that has the contents “hello world”. Here’s what I like about it: No Nix language; just the really fiddly low-level bits of building a derivation by hand It’s incremental, building from a little friendly JSON blob and incrementally adding scarier parts It only uses two low-level Nix commands One thing that I did not understand after reading, though, was where the hashes come from. Farid’s post does the same thing that I occasionally do with the C++ or Rust compiler, where we intionally cause an error to get information that the compiler already knows. That’s not very satisfying for someone (me) who is starting basically from zero. So I went down a bit of a rabbit hole trying to figure out how to manually generate these hashes. But first, let’s get some terms out of the way. Please forgive (but hel ... Read full article.