[Nix-dev] weird garbage output inside nix-shell
Roni Choudhury
aichoudh at gmail.com
Tue Jun 13 22:55:20 CEST 2017
On Sun, Jun 11, 2017 at 5:45 AM Sergiu Ivanov sivanov at colimite.fr
<http://mailto:sivanov@colimite.fr> wrote:
Thus quoth Roni Choudhury at 17:38 on Sat, Jun 10 2017:
> >
> > Linus, Sam, and Sergiu - thank you for the suggestions. I did poke
> > around in the output from `env` and discovered IN_NIX_SHELL, and
> > arranged my .zshrc to show `${name}` when `$IN_NIX_SHELL` is
> > true. Fantastic!
>
> Great job! I didn't know about that environment variable.
>
I think it should be called NIX_IN_SHELL but IN_NIX_SHELL is good too :).
> I'm not sure the other problem has to do with character encodings
> > (though I don't know too much about how that works).
>
> Ooh, sorry, I messed up in my previous E-mail by saying "ASCII terminal
> codes" :-( What I really meant was this:
>
> https://en.wikipedia.org/wiki/ANSI_escape_code
Ah ok. Well, I use terminal colors in my zsh setup so I can’t imagine it’s
a misinterpreted escape code…
> I did notice that `ldd $(which vim)` shows me different results when I
> > am inside my nix-shell vs. when I'm not.
>
> This is weird. I get exactly the same results (modulo the differences
> in the memory map addresses listed in parentheses at the end of each
> line). (I don't have vim mentioned in this particular shell.nix.)
>
Definitely weird then - is there some way to probe exactly what packages
are in my nix-shell environment? Do I do that just by following symlinks
eventually into the store?
> I kind of thought I shouldn't even be able to launch vim from inside
> > my shell if it's not listed as a buildDep.
>
> It looks to me that nix-shell _extends_ the environment it is run in.
> So, if you run nix-shell in an environment which contains vim, you have
> vim inside nix-shell.
>
Right, my mistake. Then I’m starting to think it’s that weird shifting of
dynamic libraries that’s causing my shell trouble. In fact, see below…
> If I send my shell.nix, would someone else mind trying to use it to see if
> > you can reproduce my strange results?
>
> Go ahead. (Remember to scrub all sensitive information.)
>
Thank you. I’ve attached my shell.nix file to this message.
I did discover that I can “fix” my shell problems by omitting this line
from shell.nix:
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath libs;
Without that line, my LD_LIBRARY_PATH env var just has
/run/opengl-driver/lib in it, and vim works as expected. I’m not sure why I
did this, because my build seems to work without it. This may explain why
my ldd output differs inside and outside my nix-shell environment.
So I guess my next question is: if I did want to put those packages’
libraries into my library loader path, how am I supposed to do it? I tried
this:
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${stdenv.lib.makeLibraryPath libs}";
but that doesn’t work for, perhaps, obvious reasons.
Thanks for the help on this!!
roni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170613/24575b34/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shell.nix
Type: application/octet-stream
Size: 735 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170613/24575b34/attachment.obj>
More information about the nix-dev
mailing list