1
0
Fork 0

bashrc: introduce a reboot check in PS1

This commit is contained in:
Pratham Patel 2024-03-10 06:39:30 +05:30
parent 340f8f0b4d
commit ea475fa9e1
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 8 additions and 1 deletions

View File

@ -210,9 +210,16 @@ elif command -v vi > /dev/null; then
fi
export EDITOR
function nixos_needsreboot() {
NIXOS_NEEDSREBOOT_FILE='/var/run/reboot-required'
if [[ -f "${NIXOS_NEEDSREBOOT_FILE}" ]]; then
echo -e "\nNewer version of $(cat "${NIXOS_NEEDSREBOOT_FILE}") is available!"
fi
}
# PS1 setup
PS0="\t\n" # display time in HH:MM:SS format
PS1="\n[\u@\h:\$PWD \$?]\$ "
PS1='$(nixos_needsreboot)'"\n[\u@\h:\$PWD \$?]\$ "
export PS0 PS1
# zoxide setup