feat(shell): add podman aliases and nix_env to PS1

This commit is contained in:
Marco Thomas
2023-11-28 11:24:58 +01:00
parent 7461de05bb
commit 91a7852e15
2 changed files with 16 additions and 5 deletions

View File

@@ -16,15 +16,21 @@ git_branch() {
fi fi
} }
nix_env() {
if $(echo $PATH | grep "/nix/store" > /dev/null 2>&1); then
echo "(nix)"
fi
}
HOST="\[\033[0;33m\]\h\[\033[m\]" HOST="\[\033[0;33m\]\h\[\033[m\]"
GIT="\[\033[0;31m\]\$(git_branch)\[\033[m\]" GIT_NIX="\[\033[0;31m\]\$(git_branch)\$(nix_env)\[\033[m\]"
DIR="\[\033[0;34m\]\w\[\033[m\]" DIR="\[\033[0;34m\]\w\[\033[m\]"
NEWLINE=$'\n' NEWLINE=$'\n'
PROMPT_COMMAND=__prompt_command PROMPT_COMMAND=__prompt_command
__prompt_command() { __prompt_command() {
local EXIT="$?" local EXIT="$?"
export PS1="${HOST} ${DIR} ${GIT}${NEWLINE}" export PS1="${HOST} ${DIR} ${GIT_NIX}${NEWLINE}"
local red_lambda='\[\033[0;31m\]󱞩\[\033[00m\] ' local red_lambda='\[\033[0;31m\]󱞩\[\033[00m\] '
local green_lambda='\[\033[0;32m\]󱞩\[\033[00m\] ' local green_lambda='\[\033[0;32m\]󱞩\[\033[00m\] '

View File

@@ -51,11 +51,16 @@ alias rm='rm -i'
alias t='tmux a || tmux -u' alias t='tmux a || tmux -u'
alias tw='typst watch' alias tw='typst watch'
# podman
alias pm="podman"
alias pmc="podman compose"
alias pmvol='cd ~/.local/share/containers/storage/volumes'
# commands with pre-selected flags # commands with pre-selected flags
alias mktex="latexmk -xelatex -shell-escape" alias nd="nix develop ."
alias nssh='SSH_AUTH_SOCK= ssh' alias nssh='SSH_AUTH_SOCK= ssh'
alias texmk="latexmk -xelatex -shell-escape" alias dhs='du . -hs'
alias texsh='nix-shell ~/.dots/tex.nix' alias dh1='du . -h -d1'
# nmcli # nmcli
alias con='nmcli con' alias con='nmcli con'