119 lines
3.3 KiB
Bash
119 lines
3.3 KiB
Bash
# Override in .profile.local for custom repo
|
|
DOTFILES_LOCAL_REPOSITORY="https://gitbox.branderson.io/branderson/dotfiles-local"
|
|
|
|
# Programs expected to be installed by tools
|
|
# These are the name on $PATH, not the package name
|
|
dependencies=(
|
|
tree
|
|
nvim
|
|
ag
|
|
fzf
|
|
node
|
|
cowsay
|
|
fortune
|
|
)
|
|
|
|
# Load dotfiles directory into DOTFILES_DIR
|
|
# Dotfiles directory should be in environment or ~/.dotfiles-config
|
|
if [ -f "$HOME/.dotfiles-config" ]; then
|
|
source "$HOME/.dotfiles-config"
|
|
fi
|
|
|
|
# PATHs
|
|
## Earlier paths in PATH checked first
|
|
if [ -d /usr/games ]; then
|
|
export PATH="/usr/games:$PATH"
|
|
fi
|
|
if [ -d /opt/homebrew/opt/coreutils/libexec/gnubin ]; then
|
|
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"
|
|
fi
|
|
if [ -d /opt/homebrew/opt/python@3.13/libexec/bin ]; then
|
|
export PATH="/opt/homebrew/opt/python@3.13/libexec/bin:$PATH"
|
|
fi
|
|
if [ -d /opt/homebrew/bin ]; then
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
fi
|
|
## Keep user bin directories first in PATH so they're preferred
|
|
if [ -d "$DOTFILES_DIR/bin" ]; then
|
|
export PATH="$DOTFILES_DIR/bin:$PATH"
|
|
fi
|
|
## OS-specific binaries
|
|
if [[ $OSTYPE == 'darwin'* ]]; then
|
|
if [[ -d "$DOTFILES_DIR/macbin" ]]; then
|
|
export PATH="$DOTFILES_DIR/macbin:$PATH"
|
|
fi
|
|
elif [[ $OSTYPE == 'linux'* ]]; then
|
|
if [[ -d "$DOTFILES_DIR/linbin" ]]; then
|
|
export PATH="$DOTFILES_DIR/linbin:$PATH"
|
|
fi
|
|
fi
|
|
if [ -d "$HOME/.local/bin" ]; then
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
if [ -d "$HOME/bin" ]; then
|
|
export PATH="$HOME/bin:$PATH"
|
|
fi
|
|
|
|
source "$HOME/.bash_functions"
|
|
|
|
# Set up brew if on macOS
|
|
if [[ $OSTYPE == 'darwin'* ]]; then
|
|
if [ -f /opt/homebrew/bin/brew ]; then
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
fi
|
|
fi
|
|
|
|
# Prefer alacritty terminal if installed
|
|
if program_installed alacritty; then
|
|
export TERMINAL=alacritty
|
|
fi
|
|
|
|
# Prefer neovim, if installed
|
|
if program_installed nvim; then
|
|
export EDITOR=nvim
|
|
alias vim=nvim
|
|
fi
|
|
|
|
if program_installed powerline; then
|
|
# Make powerline support Python virtualenvs
|
|
export POWERLINE_COMMAND="$HOME/dotfiles/bin/powerline-wrapper.sh"
|
|
fi
|
|
|
|
# alias make='nocorrect make'
|
|
# alias git='nocorrect git'
|
|
# Crontab
|
|
#alias crontab-e='vim ~/.crontab && crontab ~/.crontab'
|
|
|
|
#alias sl="sl -laF"
|
|
|
|
# Set up ssh-agent socket under XDG if not already set
|
|
if [ -d "$XDG_RUNTIME_DIR" ] && [ -z "$SSH_AUTH_SOCK" ]; then
|
|
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
|
fi
|
|
|
|
# Put flatpak apps in XDG
|
|
if program_installed flatpak; then
|
|
export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$XDG_DATA_DIRS"
|
|
fi
|
|
|
|
# pyenv paths
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
|
|
# Add SSH keys to agent if not already added
|
|
## Find existing keys, supporting one layer of folder organization
|
|
public_keys=($(find "$HOME/.ssh/" -maxdepth 2 -name "*.pub"))
|
|
if [ ${#public_keys[@]} -gt 0 ]; then
|
|
for public_key in "${public_keys[@]}"; do
|
|
if [[ $(uname -s) == Linux* ]]; then
|
|
# Add SSH keys only if not already present
|
|
ssh-add -l | grep -q `ssh-keygen -lf "$public_key" | awk '{print $2}'` || ssh-add -k
|
|
break
|
|
elif [[ $(uname -s) == Darwin* ]]; then
|
|
# Add SSH keys only if not already present
|
|
ssh-add -l | grep -q `ssh-keygen -lf "$public_key" | awk '{print $2}'` || ssh-add --apple-use-keychain
|
|
break
|
|
fi
|
|
done
|
|
fi
|