[Nix-dev] Trying to understand multiple versions

Josh surely.you.jest at gmail.com
Fri Apr 30 19:23:29 CEST 2010


I just learned about Nix and have been reading the documentation; it
seems like an absolutely fascinating idea, and exactly the sort of
package management I've been wanting to see for a while. I'm hoping to
use it in a project I'm building, and hopefully to contribute back to
the project. I'm a bit confused, however, as to how it handles various
real-world scenarios.

It appears that package dependencies are specified just by package,
and not version; is this correct? In other words, you say that package
A depends on package B, rather than on a specific version of package
B. (That's what appears to be going on in the documentation, but I'm
not sure; the documentation seems to show that a package specifies
dependencies by "inheriting" certain names defined in its environment;
I'm not quite clear on what those names represent, but I assume
they're variables that represent paths to installed packages?)

Consider the following scenario:

1. I install package Foo-1.0, which depends on FunnyLib. The latest
version of FunnyLib happens to be 1.0. Assumption: Package
FunnyLib-1.0 will automatically be installed as well.
2. The FunnyLib-1.1 package is released. I upgrade FunnyLib to version
1.1. Assumption: Foo will continue to use FunnyLib-1.0, and I'll have
2 versions of FunnyLib installed.
3. I install package Bar-1.0, which also uses FunnyLib. Assumption:
Nix sees that FunnyLib-1.1 is installed, and will use that.
4. I run garbage collection. Assumption: nothing happens, since both
versions of FunnyLib are currently in use.
5. I "upgrade" Foo-1.0, even though there are no new versions
available, to its already installed version. Assumption: it gets
re-linked against FunnyLib-1.1; now, FunnyLib-1.0 is eligible for
garbage collection.

Are my assumptions correct? Is there anything I'm missing above?

Suppose I never upgraded FunnyLib in step 2, but the updated package
was available. Then I installed Bar as in step 3. Would Bar use the
already installed, version of FunnyLib, or would it download and
install the latest version? I would assume the latter.

Now, suppose that Foo uses some deprecated features of FunnyLib, and
so requires a particular version, or any version in some specified
range. How can this be handled?

A lot of software looks for a config or settings file in some standard
directory like etc, as well as looking in the user's directory. I
assume that under the Nix way of doing things, this file is inside the
Nix store, in the directory for that program, yes? (I understand that
Nix has built-in support for managing the configs of some programs; my
concern is with everything else.) Assumption: every version of a
program will have its own config file, unless I hardlink them
together; and so every time a package is upgraded its configuration
gets reset to the defaults... Am I correct?

- Josh



More information about the nix-dev mailing list