Add nix-shell prompt condition
This commit is contained in:
parent
5c7fbbd20f
commit
db55b56b85
@ -23,15 +23,19 @@ fi
|
|||||||
|
|
||||||
export PS1="${green}"'\$'"${no_color} "
|
export PS1="${green}"'\$'"${no_color} "
|
||||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||||
|
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||||
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ] || [ "${SSH_TTY}" != "" ]; then
|
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ] || [ "${SSH_TTY}" != "" ]; then
|
||||||
DIRENV_PS1="${DIRENV_PS1}${blue}${HOSTNAME} ${DIRENV_PS1}"
|
DIRENV_PS1="${DIRENV_PS1}${blue}${HOSTNAME} ${DIRENV_PS1}"
|
||||||
|
NIX_SHELL_PS1="${NIX_SHELL_PS1}${green}${HOSTNAME} ${NIX_SHELL_PS1}"
|
||||||
PS1="${PS1}${blue}${HOSTNAME} ${PS1}"
|
PS1="${PS1}${blue}${HOSTNAME} ${PS1}"
|
||||||
fi
|
fi
|
||||||
export ORIG_PS1=${PS1}
|
export ORIG_PS1=${PS1}
|
||||||
|
|
||||||
if which direnv &> /dev/null; then
|
if which direnv &> /dev/null; then
|
||||||
update_prompt() {
|
update_prompt() {
|
||||||
if direnv status | grep -iEq 'RC allowed (true|0)'; then
|
if [ -n "${IN_NIX_SHELL}" ]; then
|
||||||
|
PS1=${NIX_SHELL_PS1}
|
||||||
|
elif direnv status | grep -iEq 'RC allowed (true|0)'; then
|
||||||
PS1=${DIRENV_PS1}
|
PS1=${DIRENV_PS1}
|
||||||
else
|
else
|
||||||
PS1=${ORIG_PS1}
|
PS1=${ORIG_PS1}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user