Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you misunderstand the architecture of Nix. Every package in Nix gets put into an immutable /nix/store. Packages are identified by a hash of their contents, so a small mutation of any package definition gives it a new identity, and thus, a separate package derivation.

Every package in the store has exact dependencies - they reference the hashes of other packages only. When a package is built with Nix, only the directories for these packages are exposed to the chrooted environment in which the build occurs - so it is simply not possible for some randomly added junk in the filesystem to make it's way into a nix-defined package.

Contrast this to building software on another machine, where I might depend on "glibc" version "1.0". The combination these two values hardly represents a unique identity, as I could make any random package that fits those requirements. It's much more difficult for me to create a package which results in an hash collision though.

One thing that makes the other systems so unreliable is the presence of multiple repositories. If you were going to deploy packages from a single repository, then you can do careful planning in such a way that packages do not have any collisions. Assuming no user mutates the directories under control of the package manager, such system will also be effectively reproducible. Current mainstream distros work surprisingly well because they basically use this model, where a default repository provides most users needs. These distros quickly break down when you start adding third-party repositories which bundle alternative compilations of the same software that sits in the "official" one.

Basing packages from hashes (identity), rather than names and numbers, and making sure all of the files for each package is held in an isolated directory ensures that collisions won't happen, even if two different repositories provide the same software name and number, they are represented by different hashes, and will be treated as distinct pieces of software.



I like the architecture of Nix, and believe there are many benefits to it's packaging model. However, I am not a huge fan of the syntax[1], and rather use a template engine I am quite familiar with (like jinja).

I'll continue to follow and learn more about Nix, but anxiously awaiting my epiphany.

[1] https://github.com/NixOS/nixpkgs/blob/1a504e3fb72fab10799cf0...


Yeah, problem with nix is that it's different. The nix language is a lazy-functional DSL, which takes a bit of effort to learn.

The thing is, "better" does imply "different." The syntax is weird and difficult, but it's the linchpin of the whole system. It's much, much better than your typical packaging system and worth the effort to learn it.


If you like Scheme, GNU Guix is based on Nix but uses a DSL in Guile.

http://www.gnu.org/software/guix/


Do you wish nix's syntax were more like jinja? Or do you actually want to use jinja with nix somehow? I don't really know what the latter would mean, since nix is a programming language and jinja is a (string-based) template system.


So, what do you do when you have to install a new patch level release of said glibc? Rebuild every single component on the system?

I take it configuration of the packages needs to go in nix as well? So what do you do when there is, for example, a change of upstream smtp?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: