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

Could someone explain in a simple way, why this is better that using, for example, apt-get ?


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.


> 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.


Both Guix and Nixos allow your system to be defined declaratively. This means that the details of reproducing your system state, given a declarative configuration, are fully handled by Guix/Nixos. So, if you like, you can consider the mapping between declarations and systems a pure function (i.e. you always get the same startup state for a given config). It's not hard to see how this could be valuable when deploying many servers (reproducability), getting out of dependency hell / failed upgrades (perfect rollbacks), bug reporting (just append the config that fully describes your system!), etc...

I've also found that the increasing entropy caused by stateful alternatives (e.g. apt-get) eventually becomes impossible to manage. This is entirely due to hidden state that grows in complexity over time. Eventually, things break in a way that nobody on StackOverflow has seen before, and you're SOL. In the declarative world, everything specific to your setup is required to be defined upfront, in one central place. This provides you with a much better chance of understanding your system as it evolves.

(Your account name makes me think you've appreciated functional programming data structures at some point. In not surprisingly, the benefits of immutability and declarative style in programming languages seem to carry over to configuration management.)


Others have explained it, but I like to see it like that:

- apt-get, yum, pacman and "traditional" package managers deal with _transition of your system_: _please install this packet_, _please remove this packet_

- nix and guix deal with _state of your system_: _please make sure that the final state is thus_.

This brings easy reproducibility of a system (if you have the recipe, you can have a another machine be an _exact_ copy) and de-entanglement (no more managing conflicting dependencies, no more dangling files). If I were to draw parallel, it would be like this:

- "traditional" package managers are like jQuery: you pick some DOM node / some package, and modify it / update it. After some time you don't know anymore who modified this DOM node, who needs it, ... things become hard to track

- nix and guix are like React: you specify the state you want in a single place (or rather in a definite place) and React/nix maps that definition into your final product

Here's a long blog post that goes into more detail: https://www.domenkozar.com/2014/03/11/why-puppet-chef-ansibl...


Don't know about Guix, it seems to be inspired by/similar to Nix. As far as I understand, the advantage of Nix is that it's a stateless description of the system, so the advantages are:

* you can describe a tree of dependencies using any version of the package you want, and can easily rollback to a previous tree if an update broke it

* because you describe a tree of packages, you're actually describing the complete state of the system, there's no leftovers from previous installations which make it work by chance

* as a result you can easily partially alter (and rollback) or move nix configurations from one machine to the next

Essentially nix (and guix?) merges package management and configuration management in a stateless and declarative, easily audited and customised, manner.


It's better because given the same input you always get the same output. For example, in Gentoo when one builds a package the final result depends on what's been built before. Or (killer feature for configuration management):

Suppose one has a resource for file in Puppet

file "blah" do source "yada" end

if you erase that resource, the file still stays there. With Nix/Guix anything not defined in configuration isn't present at all on system.

Another feature : one can install, for example, different versions of Python/PyPy/etc locally using the same package manager. Local and system-wide package share the same underlying files and don't interfere.

Rollbacks, very easy way to restore system packages/configs to previous working state.


Very interesting your responses. Looks interesting to try it. So it's hard / too problematic to get it working over, a Kubuntu ?


It works very well on top of an existing distribution (I'm using it on Fedora). You only need to add ~/.guix-profile/bin to your PATH once everything is installed.


apt-get can not install the same package/software in many different versions, there is always some package conflicts happening and you cant describe the state of your desired system with any "apt-get" language. You must script your desired state manually or use puppet or chef or whatever, which will perform the steps/tasks that you desire on your system using multitude of software and languages.

With guix gsd and nixos, the package manager is the configuration manager. The package manager is not just package manager, its not just apt-get, it is also puppet/chef/salt, and a distribution-maker or manager. I believe with guix you could make your own distribution (software collection) in the same descriptive language as making packages. You cant do that with apt or any debian tools.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: