What's all the hype with Nix?

It does! The two pieces are

  • There is a pure lazy untyped functional programming language. So, almost Haskell. The syntax is boring in some places, neat in others, and idiosyncratic in yet other corners. Like with any language.
  • Some values are special, namely “derivations”:
    • These values (I can’t say special type…) denote build instructions. Evaluating a nix expression to such a value is called instantiation.
    • These values can be realized. This executes the build instructions, and (if they don’t fail), produce an output path. These builds are hermetic, i.e. only stuff specified in the derivation can affect the output. Output paths are put in /nix/store, and are addressed by essentially the hash of the build instructions (not the output content).
    • Nix understands how derivations depends on storage paths, and how store paths depends on each other, so it builds what’s needed, can copy stuff including all referenced paths from caches.

That’s what I’d consider the elegant and clean core. All the rest (the sometimes obscure CLI, with old-style and new-style commands; nixpkgs with it’s concept of overlays based on recursive knots; stuff like haskell.nix) become manageable with that in mind.

9 Likes