From 91c55ffeff49ee1d2beb95faf9b301fe2c65348c Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sun, 02 Feb 2025 23:21:56 +0000
Subject: [PATCH] Add config for nix server on rpi5

---
 bash/bashrc |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/bash/bashrc b/bash/bashrc
index 3299c72..966eaaf 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -1,7 +1,44 @@
+# Set bash history size
+export HISTSIZE=10000
+export HISTCONTROL=erasedups
+shopt -s histappend
+
 # Prompt, no colours to differentiate it from zsh
-PS1="[\u@\h \W]\$ "
+parse_git_repo() {
+    git remote -v 2>/dev/null | sed -z 's/.*\/\(.*\)\.git.*/\1/g;'
+}
+
+parse_git_branch() {
+    git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
+}
+
+parse_git_tag() {
+    git describe --tags 2>/dev/null
+}
+
+git_prompt() {
+    local ret="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
+    if [ -z $ret ]; then
+        return
+    fi
+    local OUT="$(parse_git_branch)"
+    if [ "$OUT" == " (no branch)" ]; then
+        OUT="($(parse_git_tag))"
+    fi
+    if [ -n "$OUT" ]; then
+        OUT=" ($(parse_git_repo):$OUT)"
+    fi
+    echo "$OUT"
+}
+
+# PS1="[\u@\h \W]\$ "
+PS1="[\u@\h\$(git_prompt) \W]\$ "
 PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
 
+# Common completions
 source ~/.commonshell
 [ -r /usr/share/doc/pkgfile/command-not-found.bash ] && source /usr/share/doc/pkgfile/command-not-found.bash
 [ -r /usr/share/bash-completion/bash_completion   ] && . /usr/share/bash-completion/bash_completion
+
+# Ble.sh for syntax highlighting and shell completion
+[ -r ${HOME}/.ble.sh ] && source ${HOME}/.ble.sh

--
Gitblit v1.9.3