Hacker News new | ask | show | jobs
by chriswarbo 4152 days ago
Guix is based on Nix, so the following applies to both.

apt-get allows at most one version of a package to be installed at a time; if you want two versions, you need to ask the maintainers to split the package into two. Guix doesn't suffer this problem; packages are given an ID based on a hash of their contents and dependencies, so two versions will happily sit side-by-side. An "update" is treated more like installing a separate package.

If two applications depend on two different versions of some library, you can't install both applications. In Guix you can, since each can use the version it needs.

apt-get affects the whole system. All users are affected by a change; if some other user installs/removes/updates a package, you have to just deal with it. In Guix, every user gets a "profile" package, which can depend on anything they like. Installing/removing/updating packages just creates a new version of your profile, with its dependencies added/removed/changed according to what you asked for.

apt-get is stateful: the contents of /usr, /etc, etc. are changed as packages are installed/removed. Guix is immutable: packages live in their own read-only directories, so nothing can break them after installation.

apt-get can't roll back: packages can't be down-graded, all kinds of actions are taken by pre/post install scripts which can't be undone, etc. Since Guix is immutable, "rolling back" just means going back to the old selection of packages; ie. installing the old version of the profile package.

2 comments

> if you want two versions, you need to ask the maintainers to split the package into two

This is still true in Nix (and Guix I assume), although there are facilities for overriding, say, just the source tarball (to a different version) without needing to create a whole new Nix package (and worst case, creating a whole new Nix package is an order of magnitude easier than creating a Debian package in my experience).

In the "nixpkgs" set of packages, a few packages come in multiple versions (gcc, autotools come to mind), but most are only available in a single version.

Of course, once you've managed to install package-version-1, even as nixpkgs moves to version 2, 3, and so on, your version 1 can remain installed forever if you wish, and nothing can swap out the libpng, or libc or whatever it may depend on, since as you say all these can live side-by-side with other versions of themselves.

Some nice ideas there. Of course, in the real world we have our distro's package manager as a given. So I wonder how an additional package manager would work with it.