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

Rok Garbas rok at garbas.si
Thu Aug 4 14:13:27 CEST 2016


for the python development don't use nix-env but create per project
default.nix scripts and use nix-shell.

make sure you read the python section in nixpkgs manual ->
http://nixos.org/nixpkgs/manual/

if you're looking to generate nix expressions from requirements.txt
checkout pypi2nix -> https://github.com/garbas/pypi2nix. also know
that pypi2nix is in early stage - still it is giving good results for
some - and i'm looking for feedback of packages that break since this
is the only way i can fix it.


On Thu, Aug 4, 2016 at 2:07 PM, Guillaume Maudoux (Layus)
<layus.on at gmail.com> wrote:
> Hi,
>
> I think you are putting your efforts in the wrong direction.
> Nix is not designed to install both python 3.4 and 3.5 in the same
> environment.
>
> What it can do however is cache both in the store, so you can get an
> environment with python 3.4 with
> nix-shell -p python34
> and an environment with python 3.5 with
> nix-shell -p python35
>
> Nix can provide you with as many different environments at the same time.
> You can have a shell with python 3.4 running besides a shell with python
> 3.5.
> You should however not install both in your default environment (nix-env
> -i) as it won't work.
>
> May I refer you to https://nixos.org/wiki/Development_Environments ?
>
> Regards,
> -- Layus.
>
>
> Le 03/08/16 à 16:43, Roland Koebler a écrit :
>> 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
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



-- 
Rok Garbas
https://garbas.si


More information about the nix-dev mailing list