Modify shell prompt - kdaisho/Blog GitHub Wiki

You might want to display the current shell environment in shell prompt (nix-shell):

(nix-shell) username@username-laptop:~$

Add this to your .bashrc or .zshrc file.

# Check if we are in a Nix environment
if [ -n "$IN_NIX_SHELL" ](/kdaisho/Blog/wiki/--n-"$IN_NIX_SHELL"-); then
    export PS1="(nix) $PS1"
else
    nix-shell
fi