Skip to content

Commit

Permalink
Preserve PS1 for nix-shell
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilchm committed Aug 8, 2022
1 parent 2268d21 commit 21c56c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 11 additions & 1 deletion bash-config/bashrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
source ~/.term_profile

if [[ -z "$IN_NIX_SHELL" ]]; then # special PS1 is set for nxs nix-shells
PS1='\[\033[35m\]\t\[\033[m\]$(git-radar --bash) \$ '
fi
if [[ -n "$IN_NIX_SHELL" ]]; then # mark all nix-shells (custom)
if [[ "$PS1" == '\s-\v\$ ' ]]; then # default (empty) PS1
PS1='\[\e[0;38;5;40m\]*\[\e[0m\]\[\033[35m\]\t\[\033[m\]$(git-radar --bash) \$ '
fi
fi

export LOCALE_ARCHIVE=@glibcLocales@/lib/locale/locale-archive

export EDITOR=vim
Expand Down Expand Up @@ -34,11 +43,12 @@ export JAVA_HOME="@jdk@"

alias chromium-dark="chromium --enable-features=WebContentsForceDark"

export NIX_SHELL_PRESERVE_PROMPT=1
nxs() {
sfile="@shells@/$1.nix"
if [[ ! -f $sfile ]]; then
echo "No shell named '$1' defined"
return
fi
nix-shell $sfile
PS1="\[\e[0;38;5;40m\]<$1>\[\e[0m\] $PS1" nix-shell $sfile
}
4 changes: 1 addition & 3 deletions termite-config/term_profile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!bin/bash
#!/usr/bin/env bash

stty -ixon

PS1='\[\033[35m\]\t\[\033[m\]$(git-radar --bash) \$ '

eval "$(dircolors -b ~/.dircolors)"
alias ls='ls --color=auto'

Expand Down

0 comments on commit 21c56c3

Please sign in to comment.