187 lines
5.5 KiB
Bash
187 lines
5.5 KiB
Bash
# HISTFILE Configuration (Bash equivalent)
|
|
HISTFILE=~/.bash_history
|
|
HISTSIZE=1000
|
|
HISTFILESIZE=2000 # Adjusted to match both histfile and size criteria
|
|
|
|
# GPU Related shenanigans
|
|
if [ "$(hostname)" = "mennos-desktop" ]; then
|
|
export DRI_PRIME=1
|
|
export MESA_VK_DEVICE_SELECT=1002:744c
|
|
fi
|
|
|
|
if [ -f /etc/os-release ]; then
|
|
distro=$(awk -F= '/^NAME/{print $ssss2}' /etc/os-release | tr -d '"')
|
|
if [[ "$distro" == *"Pop!_OS"* ]]; then
|
|
export CGO_CFLAGS="-I/usr/include"
|
|
fi
|
|
fi
|
|
|
|
# Docker Compose Alias (Mostly for old shell scripts)
|
|
alias docker-compose='docker compose'
|
|
|
|
# tatool aliases
|
|
alias tls='tatool ls -g'
|
|
alias tps='tls'
|
|
alias ti='tatool doctor'
|
|
alias td='tatool doctor'
|
|
alias tr='tatool restart'
|
|
alias tsrc='tatool source'
|
|
|
|
# Modern tools aliases
|
|
alias l="eza --header --long --git --group-directories-first --group --icons --color=always --sort=name --hyperlink -o --no-permissions"
|
|
alias ll='l'
|
|
alias la='l -a'
|
|
alias cat='bat'
|
|
alias du='dust'
|
|
alias df='duf'
|
|
alias augp='sudo apt update && sudo apt upgrade -y && sudo apt autopurge -y && sudo apt autoclean'
|
|
|
|
# Docker Aliases
|
|
alias d='docker'
|
|
alias dc='docker compose'
|
|
alias dce='docker compose exec'
|
|
alias dcl='docker compose logs'
|
|
alias dcd='docker compose down'
|
|
alias dcu='docker compose up'
|
|
alias dcp='docker compose ps'
|
|
alias dcps='docker compose ps'
|
|
alias dcpr='dcp && dcd && dcu -d && dcl -f'
|
|
alias dcr='dcd && dcu -d && dcl -f'
|
|
alias ddpul='docker compose down && docker compose pull && docker compose up -d && docker compose logs -f'
|
|
alias docker-nuke='docker kill $(docker ps -q) && docker rm $(docker ps -a -q) && docker system prune --all --volumes --force && docker volume prune --force'
|
|
|
|
# Git aliases
|
|
alias g='git'
|
|
alias gg='git pull'
|
|
alias gl='git log --stat'
|
|
alias gp='git push'
|
|
alias gs='git status -s'
|
|
alias gst='git status'
|
|
alias ga='git add'
|
|
alias gc='git commit'
|
|
alias gcm='git commit -m'
|
|
alias gco='git checkout'
|
|
alias gcb='git checkout -b'
|
|
|
|
# Kubernetes aliases (Minikube)
|
|
alias kubectl="minikube kubectl --"
|
|
|
|
# netstat port in use check
|
|
alias port='netstat -atupn | grep LISTEN'
|
|
|
|
# random string (Syntax: random <length>)
|
|
alias random='openssl rand -base64'
|
|
|
|
# Alias for ls to l but only if it's an interactive shell because we don't want to override ls in scripts which could blow up in our face
|
|
if [ -t 1 ]; then
|
|
alias ls='l'
|
|
fi
|
|
|
|
# PATH Manipulation
|
|
export DOTFILES_PATH=$HOME/.dotfiles
|
|
export PATH=$PATH:$HOME/.local/bin
|
|
export PATH=$PATH:$HOME/.cargo/bin
|
|
export PATH=$PATH:$DOTFILES_PATH/bin
|
|
|
|
# Include pnpm if it exists
|
|
if [ -d "$HOME/.local/share/pnpm" ]; then
|
|
export PATH=$PATH:$HOME/.local/share/pnpm
|
|
fi
|
|
|
|
# Miniconda
|
|
export PATH="$HOME/miniconda3/bin:$PATH"
|
|
|
|
# In case $HOME/.flutter/flutter/bin is found, we can add it to the PATH
|
|
if [ -d "$HOME/.flutter/flutter/bin" ]; then
|
|
export PATH=$PATH:$HOME/.flutter/flutter/bin
|
|
export PATH="$PATH":"$HOME/.pub-cache/bin"
|
|
|
|
# Flutter linux fixes:
|
|
export CPPFLAGS="-I/usr/include"
|
|
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lbz2"
|
|
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
|
|
fi
|
|
|
|
# Add flatpak to XDG_DATA_DIRS
|
|
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share
|
|
|
|
# Allow unfree nixos
|
|
export NIXPKGS_ALLOW_UNFREE=1
|
|
|
|
# Allow insecure nixpkgs
|
|
export NIXPKGS_ALLOW_INSECURE=1
|
|
|
|
# 1Password SSH Agent
|
|
export SSH_AUTH_SOCK=$HOME/.1password/agent.sock
|
|
|
|
# Tradaware / DiscountOffice Configuration
|
|
if [ -d "/home/menno/Projects/Work" ]; then
|
|
export TRADAWARE_DEVOPS=true
|
|
fi
|
|
|
|
# 1Password Source Plugin (Assuming bash compatibility)
|
|
if [ -f /home/menno/.config/op/plugins.sh ]; then
|
|
source /home/menno/.config/op/plugins.sh
|
|
fi
|
|
|
|
# Initialize starship if available
|
|
if ! command -v starship &> /dev/null; then
|
|
echo "FYI, starship not found"
|
|
else
|
|
export STARSHIP_ENABLE_RIGHT_PROMPT=true
|
|
export STARSHIP_ENABLE_BASH_CONTINUATION=true
|
|
eval "$(starship init bash)"
|
|
fi
|
|
|
|
# Read .op_sat
|
|
if [ -f ~/.op_sat ]; then
|
|
export OP_SERVICE_ACCOUNT_TOKEN=$(cat ~/.op_sat)
|
|
|
|
# Ensure .op_sat is 0600 and only readable by the owner
|
|
if [ "$(stat -c %a ~/.op_sat)" != "600" ]; then
|
|
echo "WARNING: ~/.op_sat is not 0600, please fix this!"
|
|
fi
|
|
|
|
if [ "$(stat -c %U ~/.op_sat)" != "$(whoami)" ]; then
|
|
echo "WARNING: ~/.op_sat is not owned by the current user, please fix this!"
|
|
fi
|
|
fi
|
|
|
|
# Source nix home-manager
|
|
if [ -f "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
|
|
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
|
fi
|
|
|
|
# Source ble.sh if it exists
|
|
if [[ -f "${HOME}/.nix-profile/share/blesh/ble.sh" ]]; then
|
|
source "${HOME}/.nix-profile/share/blesh/ble.sh"
|
|
|
|
# Custom function for fzf history search
|
|
function fzf_history_search() {
|
|
local selected
|
|
selected=$(history | fzf --tac --height=40% --layout=reverse --border --info=inline \
|
|
--query="$READLINE_LINE" \
|
|
--color 'fg:#ebdbb2,bg:#282828,hl:#fabd2f,fg+:#ebdbb2,bg+:#3c3836,hl+:#fabd2f' \
|
|
--color 'info:#83a598,prompt:#bdae93,spinner:#fabd2f,pointer:#83a598,marker:#fe8019,header:#665c54' \
|
|
| sed 's/^ *[0-9]* *//')
|
|
if [[ -n "$selected" ]]; then
|
|
READLINE_LINE="$selected"
|
|
READLINE_POINT=${#selected}
|
|
fi
|
|
ble-redraw-prompt
|
|
}
|
|
|
|
# Bind Ctrl+R to our custom function
|
|
bind -x '"\C-r": fzf_history_search'
|
|
fi
|
|
|
|
# In case a basrc.local exists, source it
|
|
if [ -f $HOME/.bashrc.local ]; then
|
|
source $HOME/.bashrc.local
|
|
fi
|
|
|
|
# Display a welcome message for interactive shells
|
|
if [ -t 1 ]; then
|
|
dotf hello
|
|
fi
|