[Nix-dev] nix-shell is unable to install the package which nix-env just returned

Dmitry Malikov malikov.d.y at gmail.com
Thu Mar 31 15:30:57 CEST 2016


> What's the output of (normal user)
> $ nix-channel --list

Well, it's empty.

> To inspect your system state, try to run

>> nix-instantiate --eval --expr --strict "<nixpkgs>"
/nix/store/bc71r4k7bms0ykfl5zxgww1fi3kb0jdw-nixos-15.09.1180.e8e1cb8/nixos/nixpkgs
>> nix-instantiate --eval --expr --strict "<nixos>"
/nix/store/bc71r4k7bms0ykfl5zxgww1fi3kb0jdw-nixos-15.09.1180.e8e1cb8/nixos/nixos
>> sudo nix-instantiate --eval --expr --strict "<nixpkgs>"
/nix/store/bc71r4k7bms0ykfl5zxgww1fi3kb0jdw-nixos-15.09.1180.e8e1cb8/nixos/nixpkgs
>> sudo nix-instantiate --eval --expr --strict "<nixos>"
/nix/store/bc71r4k7bms0ykfl5zxgww1fi3kb0jdw-nixos-15.09.1180.e8e1cb8/nixos/nixos

><nixpkgs> gets evaluated in the context of the current user, so you will
get very different results when using sudo.
Nah, they look pretty much the same.

> Now, there is no reason for the attribute returned by `nix-env -f
"<nixpkgs>" -qaP` to be missing when calling `nix-shell "<nixpkgs>" -p`
because the nixpkgs are exactly the same.

Yep, probably this explains something.
>> nix-env -qaP -f "<nixpkgs>" | grep letsencrypt
>>

So, what are the best practices of having nixos and nixpkgs-unstable
channels? Should root user be subscribed to nixos and the normal user to
nixpkgs one?

On 31 March 2016 at 11:46, Guillaume Maudoux (Layus) <layus.on at gmail.com>
wrote:

> Hmm.. could it be that your system is confused by multiple channels ?
>
> What's the output of (normal user)
> $ nix-channel --list
>
> I think your best bet is `nix-shell "<nixpkgs>" -p letsencrypt`
> where nixpkgs is your channel name.
>
> You can even go further and set the nixpkgs path directly using
> nix-shell
> /nix/store/7kxsv9svwcaxzkxxjg0zxcb151mic8vw-nixos-16.03pre76756.885acea/nixos/nixpkgs
> -p letsencrypt
>
> nix-env can also take such a path
>
> To inspect your system state, try to run
> $ nix-instantiate --eval --expr --strict "<nixpkgs>"
> $ nix-instantiate --eval --expr --strict "<nixos>"
> $ sudo nix-instantiate --eval --expr --strict "<nixpkgs>"
> $ sudo nix-instantiate --eval --expr --strict "<nixos>"
>
> <nixpkgs> gets evaluated in the context of the current user, so you will
> get very different results when using sudo.
>
> To ensure a consistent result, you can also pass the nixpkg tree to
> nix-env with option -f.
> $ nix-env -qaP -f "<nixpkgs>"
>
> Now, there is no reason for the attribute returned by `nix-env -f
> "<nixpkgs>" -qaP` to be missing when calling `nix-shell "<nixpkgs>" -p`
> because the nixpkgs are exactly the same.
>
> All this highlights the inconsistency between (and within) the tools.
> But that's another story :-).
>
> Layus.
>
> Le 31/03/16 11:25, Dmitry Malikov a écrit :
>
> >> nix-shell -p nixpkgs.pkgs.letsencrypt
> error: undefined variable ‘nixpkgs’ at (string):1:66
> (use ‘--show-trace’ to show detailed location information)
>
> Any other ideas?
>
> On 31 March 2016 at 10:37, Arseniy Seroka <ars.seroka at gmail.com> wrote:
>
>> nix-shell -p nixpkgs.pkgs.letsencrypt
>>
>> --
>> Sincerely,
>> Arseniy Seroka
>>
>> On 31 March 2016 02:21:40 Dmitry Malikov < <malikov.d.y at gmail.com>
>> malikov.d.y at gmail.com> wrote:
>>
>>> >> sudo nix-channel --list
>>> nixpkgs https://nixos.org/channels/nixpkgs-unstable
>>> nixos https://nixos.org/channels/nixos-15.09
>>>
>>> >> nixos-version
>>> 15.09.1180.e8e1cb8 (Dingo)
>>>
>>> >> nix-env --version
>>> nix-env (Nix) 1.10
>>>
>>> Anything else?
>>>
>>> On 31 Mar 2016, at 00:45, Jonn Mostovoy < <jm at memorici.de>jm at memorici.de>
>>> wrote:
>>>
>>> Just worked for me, exactly the same command.
>>> My version of nixpkgs is way older though.
>>> On Mar 31, 2016 12:40 AM, "Dmitry Malikov" < <malikov.d.y at gmail.com>
>>> malikov.d.y at gmail.com> wrote:
>>>
>>>> >>
>>>> nix-env -qaP '*' | grep letsencrypt
>>>> nixpkgs.letsencrypt
>>>> letsencrypt-0.4.0
>>>>
>>>> >> nix-shell -p letsencrypt
>>>> error: undefined variable ‘letsencrypt’ at (string):1:66
>>>> (use ‘--show-trace’ to show detailed location information)
>>>>
>>>>
>>>> What am I missing here?
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>
>
> _______________________________________________
> nix-dev mailing listnix-dev at lists.science.uu.nlhttp://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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160331/a274093e/attachment-0001.html 


More information about the nix-dev mailing list