[Nix-dev] multiple versions of the same software? / collisions

Roland Koebler rk-list at simple-is-better.org
Wed Aug 3 16:43:45 CEST 2016


Hi,

I think I've now found out (at least partially), although this could
result in a package being installed multiple times.

> It appears that the flag setting only works on already installed packages.
Yes, and if I use 

    $ nix-env -i python3-3.5.2
    ...
    $ nix-env --set-flag priority 10 python3-3.5.2
    ...
    $ nix-env -i python3-3.4.5 python3-3.5.2
    replacing old ‘python3-3.5.2’
    installing ‘python3-3.4.5’
    installing ‘python3-3.5.2’

it does not work, since the last command first removes python3-3.5.2,
then probably the flag is lost, and then installs it again.

> Also I'm not sure, but even if there are name collisions in the user
> environment, it should still be possible to install both packages but only
> use one of the names, and then create your name alias to the non-named
> package. However I do not know how this can be done.
I think I've found out. The following works:

    $ nix-env -i python3-3.5.2
    $ nix-env --set-flag priority 10 python3-3.5.2
    $ nix-env -i -P python3-3.4.5

--preserve-installed / -P was the relevant switch.
However, this can have some strange side-effects, since -P can
cause a package to be installed "multiple times":

    $ nix-env -i -P python3-3.4.5
    ...
    $ nix-env -i -P python3-3.4.5
    ...
    $ nix-env -i -P python3-3.4.5
    ...
    $ nix-env -q
    ...
    python3-3.4.5
    python3-3.4.5
    python3-3.4.5
    python3-3.4.5
    ...

This could then be "resolved" by:

    $ nix-env -e python3-3.4.5
    uninstalling ‘python3-3.4.5’
    uninstalling ‘python3-3.4.5’
    uninstalling ‘python3-3.4.5’
    uninstalling ‘python3-3.4.5’
    $ nix-env -P -i python3-3.4.5
    installing ‘python3-3.4.5’

But it still looks strange.
Is this intentional?

Roland



More information about the nix-dev mailing list