nix-v0/src/home/shell/bash.nix
2024-11-03 15:27:57 -06:00

31 lines
861 B
Nix

{
lib,
pkgs,
config,
...
}:
{
programs.bash.enable = true;
programs.bash.enableVteIntegration = true;
programs.bash.bashrcExtra = lib.mkAfter ''
if [ "$term" != "dumb" ] || [ -n "$inside_emacs" ]; then
prompt_color="1;32m"
if [ -n "$inside_emacs" ]; then
# emacs term mode doesn't support xterm title escape sequence (\e]0;)
PS1="\n\[\033[$prompt_color\][\h \w]\\$\[\033[0m\] "
else
PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[33m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]:\[\e[36m\]\w\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[33m\]\\$\[\e[m\] "
# PS1="\n\[\033[$prompt_color\][\[\e]0;\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] "
fi
if test "$term" = "xterm"; then
PS1="\[\033]2;\h:\u:\w\007\]$PS1"
fi
fi
'';
custom.persist = {
home.files = [
".bash_history"
];
};
}