On 07/06/17 14:24, Roni Choudhury wrote:
> On Wed, Jun 7, 2017 at 12:14 AM Samuel Leathers <dis...@gmail.com
> <mailto:dis...@gmail.com>> wrote:
> 
>     I use nix-shell --run zsh. I alias that to nshell.
> 
> Thanks, Sam, this is a great idea! On this note, do you know of a good
> way to update the prompt to reflect the nix-shell environment I'm in?
> i.e., is there a way to *name* the nix-shell env, and get access to that
> name through an environment variable?

Since everything that's passed to stdenv.mkDerivation ends up as an
environment variable, you can use the "name" environment variable. In my
case, my prompt function contains:

if [[ $IN_NIX_SHELL ]]; then
  printf "(%s)" "${name:-nix-shell}"
fi


> I wanted to add that even if I don't drop into zsh as my first act in
> the nix-shell, I still get that weird output from executables not in the
> environment (such as `zsh` and `git`). If anyone has any insight or can
> answer my other question, that would be great.

This is guesswork, but it could be locale-related. Do you use UTF-8
locales everywhere, or do you use other encodings that might mess up if
interpreted as UTF-8? Does setting LC_ALL=en_US.UTF-8 within the shell help?


Linus
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to