logoalt Hacker News

ameliaquiningyesterday at 11:24 PM2 repliesview on HN

Can you explain how this works? Is it different from what's described in the "Language vs. system package managers" section of the post?


Replies

MadnessASAPtoday at 12:19 AM

Yes! Nixpkgs straddles both worlds, like a system package manager it provides a way to install packages and their dependencies. However, like most language package managers it also imposes a locking mechanism so that every input into the nix expression* is locked to a hash, the mechanism is recursive and handles multiple versions of the same package in parallel.

The recent(ish) concept of "nix flakes" means there are 2 related but different mechanisms for achieving this but the end result is the same.

* In the land of NixOS everything is a nix expression including the system packages, configuration files, install image. It's all locked to hashes of upstream sources and is in theory, fully byte-identical reproducible.

mpalmertoday at 12:08 AM

Yeah, definitely. Think of it as what the post calls a "system" package manager. The difference between nix and the SPMs mentioned by the post is that in the former case, control over dependencies lies with you, not with the package manager.

In other words, with nix you decide the spec of the software you want installed on your machine, not the maintainer of your chosen package manager. Depending on your use case and knowledge/experience level, either choice may be preferable.

Also, nixpkgs is definitively the widest-spanning "package manager" on the "market"; see link.

https://en.wikipedia.org/wiki/Nix_(package_manager)#Nixpkgs