Nix: An idea whose time has come
&gt; Whatever package is thrown your way, you can rebuild it locally and check whether you have the expected build output. This is analogous to verifying a binary downloaded from the Web by computing its sha256 hash, and comparing it to the one provided by the publisher of the binary.<p>Can someone explain this to me?<p>There is an experimental feature to add content-addressable packages that will give you this, but Nix package hashes are hashes of a <i>package description</i>, not the <i>package</i>, so you can&#x27;t use them like a checksum. You can say &quot;Hey do you have this package I want?&quot; and a server can use the input hash to find what you&#x27;re talking about, but there&#x27;s no way that you can verify that what they gives you represents a good-faith attempt to build the package.<p>I would also be very surprised to learn that a significant portion of Nixpkgs is &quot;bit-for-bit&quot; reproducible. That&#x27;s hard! It&#x27;s hard enough to get packages to work with Nix at all, and very few compilers&#x2F;build systems&#x2F;etc are actually concerned with literal reproducibility. Nix doesn&#x27;t magically provide that.<p>(There are also &quot;fixed-output&quot; package descriptions which are mostly used when you&#x27;re downloading sources from the internet -- those actually are checksummed and verified, in case the remote source changed. I guess you could use that same mechanism for a build output, but you... don&#x27;t?)<p>Anyway, maybe this is a reference to the (experimental! bleeding edge!) content-addressable store stuff, but I don&#x27;t think it&#x27;s fair to call that a selling point of Nix yet. (Or I am way out of line. I don&#x27;t really know what I&#x27;m talking about.)<p>&gt; Why is this important? Because it removes the need to trust the provider and makes the cost of detecting a failure or an attack much lower for the developer. Reproducibility means security for your systems and applications, and peace of mind for your developers.<p>There is a large amount of trust when you download a binary Nix file, which is why you have to configure only trusted cache servers, and why cache servers will only accept submissions from trusted sources.<p>Reproducibility <i>is</i> really important, and a great feature of Nix -- you <i>can</i>, given a package description, build it yourself instead of downloading it -- but emphasizing security and trust seems very misleading to me. If someone can clarify these points I would appreciate learning something new about Nix.<p>&gt; Nix undoubtedly has a steep learning curve, and there are two reasons for that. First, using Nix entails rethinking a lot of accepted wisdom and practices that have become second nature for a developer. Unlearning is hard. Second, Nix surfaces all the complexity involved in building software and forces you to deal with it. In order to make builds truly reproducible, this is largely inevitable.<p>I disagree very strongly with these two statements. This reads like &quot;It&#x27;s not Nix&#x27;s fault that it&#x27;s hard to learn; it&#x27;s your fault for not trying hard enough.&quot;<p>I think that&#x27;s <i>absolutely</i> not true. Nix <i>is</i> hard to learn, and it&#x27;s <i>mostly</i> Nix&#x27;s own fault -- which is a good thing! Because it means that it&#x27;s fixable. Nix&#x27;s approach to package management isn&#x27;t some fundamentally difficult concept to wrap your head around. The concepts and ideas are pretty straightforward, once you understand them -- but how are you supposed to understand them?<p>The Nix manual is sort of infamous, and not without reason. Nowhere in the manual will it teach you how to write a standalone package description -- although it will show you how to contribute one to the Nixpkgs repo, which is a pretty different flow. It doesn&#x27;t really explain the high-level mental model I have of the Nix store as a simple graph database. There is almost no coverage of nix-shell, or the things it can do (which include some really cool things! Shebangs that explicitly list all of your scripts dependencies!). The quick start guide, until quite recently, explained how to install packages using the &quot;wrong&quot; command -- `nix-env -i git` -- which takes about a minute to run on my machine. (The &quot;right&quot; command -- `nix-env -iA nixpkgs.git` -- is instantaneous.)<p>But it&#x27;s not just the documentation&#x27;s fault. Why is there a wrong way to install packages in the first place? It&#x27;s one of many weird historical mistakes, which are all forgivable independently, but which add up to one of the most confusing and inconsistent command-line interfaces I have ever used. `nix-env -e` takes glob-looking things, but `nix-env -q` takes regular expressions... I dunno. There are tons of things like that. (There is a new command-line interface that you can opt into by editing a Nix config file, which is <i>much</i> better, but not without its own fun new set of problems.)<p>In my experience the incidental complexity of Nix was a much larger barrier to learning about Nix than the &quot;actual&quot; complexity of bundling and building software that the article places the blame on.<p>In case this wall of text should come across the wrong way: I love Nix, and I wouldn&#x27;t want to give it up for anything. I switched away from Homebrew about a year ago and haven&#x27;t looked back. I am someone who writes a lot of random scattered projects in lots of different languages, and being able to document &quot;system&quot; dependencies on things like pango or imagemagick or pcre or whatever is really useful for me, as a way to augment my cabal files or package.json files or whatever else.<p>But it was pretty hard to learn how to wield it effectively. And I wish that others could experience the benefits without having to go through what I did (although if you want to go through what I did, I wrote about the experience here: <a href="https:&#x2F;&#x2F;ianthehenry.com&#x2F;posts&#x2F;how-to-learn-nix&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ianthehenry.com&#x2F;posts&#x2F;how-to-learn-nix&#x2F;</a>).<p>Someone already said this but yeah, Nix the idea: long overdue. Nix the implementation: maybe check back in a couple years.