dotfiles/shell-init

97 lines
2.4 KiB
Bash

#!/usr/bin/env bash
# Copyright (C) Harsh Shandilya <me@msfjarvis.dev>
# SPDX-License-Identifier: MIT
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)/scripts"
# shellcheck disable=SC1091
if [ -e "${HOME}"/.nix-profile/etc/profile.d/nix.sh ]; then
source "${HOME}"/.nix-profile/etc/profile.d/nix.sh
fi
# Local bin directory
[ -d "${HOME}/bin" ] && export PATH="${HOME}/bin:${PATH}"
# SDKMAN!
export SDKMAN_DIR="${HOME}/.sdkman"
# shellcheck disable=SC1091
[[ -s "${SDKMAN_DIR}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR}/bin/sdkman-init.sh"
# cargo env
# shellcheck disable=SC1091
if [ -f "${HOME}"/.cargo/env ]; then
source "${HOME}"/.cargo/env
fi
# Shell PS1
# shellcheck disable=SC2154
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\W\[\033[00m\]$(__git_ps1 " (%s)") \$ '
# Set ccache dir
export CCACHE_DIR="${HOME}/.ccache"
# Android env variables
if [ -d ~/Android/Sdk ]; then
export ANDROID_HOME=~/Android/Sdk
fi
# Sexy colors in `ls`
if type vivid &> /dev/null; then
LS_COLORS="$(vivid generate snazzy)"
export LS_COLORS
fi
# Bash completion
for DIR in "${HOME}"/bash_completion.d "${HOME}"/.nix-profile/share/bash-completion/completions; do
# shellcheck disable=SC1090
if [ -d "${DIR}" ]; then
for COMPLETION in "${DIR}"/*; do
# shellcheck disable=SC1090
[[ -r $COMPLETION ]] && source "$COMPLETION"
done
fi
done
# Enable pass user extensions
if type pass &> /dev/null; then
export PASSWORD_STORE_ENABLE_EXTENSIONS=true
fi
# Nano love, or is it?
if type micro &> /dev/null; then
export EDITOR=micro
export MICRO_TRUECOLOR=1
fi
# Setup zoxide
if type zoxide &> /dev/null; then
alias cd=z
fi
# Spicetify
if [ -d "${HOME}/.spicetify" ]; then
export PATH="${PATH}:${HOME}/.spicetify"
fi
# shellcheck source=bash_completions.bash
source "${SCRIPT_DIR}"/bash_completions.bash
# shellcheck source=aliases
source "${SCRIPT_DIR}"/aliases
# shellcheck source=apps
source "${SCRIPT_DIR}"/apps
# shellcheck source=common
source "${SCRIPT_DIR}"/common
# shellcheck source=devtools
source "${SCRIPT_DIR}"/devtools
# shellcheck source=files
source "${SCRIPT_DIR}"/files
# shellcheck source=gitshit
source "${SCRIPT_DIR}"/gitshit
# shellcheck source=nix
source "${SCRIPT_DIR}"/nix
# shellcheck source=system
source "${SCRIPT_DIR}"/system
# shellcheck source=system_linux
source "${SCRIPT_DIR}"/system_linux