Personal dotfiles for Linux, mostly for Nixpkgs/NixOS-based and Termux setups. Mirrored using GitLab's push mirroring feature. gitlab.com/andreijiroh-dev/dotfiles
linux dotfiles
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore(bash): update shellrc files as usual

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.xyz>

+83 -9
+5 -3
.bash_login
··· 1 1 #!/usr/bin/env bash 2 + # # shellcheck disable=SC2046,SC1091,SC2155 2 3 3 4 # Stage 0: Source dotenv stuff from homedir 4 5 source "$HOME/.env" 5 6 if [[ -f "$HOME/.env.local" ]]; then 6 7 source "$HOME/.env.local" 7 - LOCAL_DOTENV_LOADED=true 8 + export LOCAL_DOTENV_LOADED=true 8 9 fi 9 10 10 11 if [[ $TERMUX ]]; then 11 12 export SSH_AGENT_=todo 12 13 elif command -v keychain >> /dev/null; then 13 - export KEYCHAIN_PATh=$(command -v keychain) 14 + export KEYCHAIN_PATH=$(command -v keychain) 14 15 eval $(keychain --agents gpg,ssh --eval) 15 16 fi 16 17 ··· 19 20 . "$HOME/.config/localconfig.env" 20 21 fi 21 22 22 - _byobu_sourced=1 . /usr/bin/byobu-launch 2>/dev/null || true 23 + # # shellcheck source=./.bashrc 24 + source ./.bashrc
+3 -2
.bashrc
··· 63 63 source "$HOME/.bashbox/env" 64 64 fi 65 65 66 - # handle hostname generation for importing host-specific configs 67 - # TODO: Handle detection when we don't have WSL_* variables on tmux shell sessions 66 + # Formerly: handle hostname generation for importing host-specific configs 67 + # TODO: Handle detection across distributions without chaos, especially where 68 + # Nix is installed (not NixOS) 68 69 if [[ $WSL_DISTRO_NAME ]] && [[ $WSL_INTEROP ]]; then 69 70 HOSTNAME_BASH="$(cat /etc/hostname)-wsl-${WSL_DISTRO_NAME}" 70 71 export WSL=1 # similar to CODESPACES and GITPOD_WORKSPACE_ID vars
+1 -1
.config/bash/aliases
··· 1 1 # General 2 2 alias clear="printf '\033c'" # faster than ncurses clear by a lot 3 3 alias c='clear' 4 - alias bashrc="nano ~/.bashrc && source ~/.bashrc" 4 + alias bashrc="${EDITOR:-"nano"} ~/.bashrc && source ~/.bashrc" 5 5 # LS 6 6 alias ls='ls --color=auto -FAh' 7 7 alias ll='ls -l'
+2 -1
.config/bash/bashrc
··· 68 68 # ~/.bash_aliases, instead of adding them here directly. 69 69 # See /usr/share/doc/bash-doc/examples in the bash-doc package. 70 70 71 - source "${HOME}/.config/aliases" 71 + source "${HOME}/.config/bash/aliases" 72 72 source "${HOME}/.config/bash/tools/automated-deploy.bashrc" 73 + source "${HOME}/.config/bash/functions" 73 74 74 75 # enable programmable completion features (you don't need to enable 75 76 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+67
.config/bash/functions
··· 1 + #!/usr/bin/env bash 2 + # shellcheck disable=SC2046 3 + 4 + # handle .env.keys detection 5 + _load_env_keys() { 6 + if [[ "$LAST_DOTENV_DIR" == "$PWD" ]]; then 7 + return 8 + elif [[ "$LAST_DOTENV_DIR" != "$PWD" ]] && [ -f "$LAST_DOTENV_DIR/.env.keys" ]; then 9 + return 10 + fi 11 + 12 + if [ -f "$PWD/.env.keys" ] && [[ "$LOADED_DOTENV_KEYS" != "1" ]]; then 13 + echo "dotenv-keys: loading up dotenv keys from this directory" 14 + 15 + # TODO: Add source link since it is obviously copied from Stack Overflow. 16 + unamestr=$(uname) 17 + if [ "$unamestr" = 'Linux' ]; then 18 + export $(grep -v '^#' .env.keys | xargs -d '\n') 19 + elif [ "$unamestr" = 'FreeBSD' ] || [ "$unamestr" = 'Darwin' ]; then 20 + export $(grep -v '^#' .env.keys | xargs -0) 21 + fi 22 + 23 + export DOTENV_KEYS_LOADED=1 LAST_DOTENV_DIR=$PWD DOTENV_KEYS_LOADER=auto 24 + elif [ ! -f "$PWD/.env.keys" ] && [[ "$LOADED_DOTENV_KEYS" == "1" ]]; then 25 + echo "dotenv-keys: unloading dotenv keys" 26 + unset "${!DOTENV_PRIVATE_KEYS*}" DOTENV_KEYS_LOADED DOTENV_KEYS_LOADER 27 + export LAST_DOTENV_DIR=$PWD 28 + fi 29 + } 30 + 31 + if [[ ";${PROMPT_COMMAND[*]:-};" != *";_load_env_keys;"* ]]; then 32 + if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then 33 + PROMPT_COMMAND=(_load_env_keys "${PROMPT_COMMAND[@]}") 34 + else 35 + PROMPT_COMMAND="_load_env_keys${PROMPT_COMMAND:+;$PROMPT_COMMAND}" 36 + fi 37 + fi 38 + 39 + # Allow manual access to .env.keys, even without the keys autoloader. 40 + dotenv-keys() { 41 + if [[ $1 == "load" ]]; then 42 + if [ ! -f "$PWD/.env.keys" ]; then 43 + echo "error: missing dotenv encryption keys" 44 + return 1 45 + fi 46 + 47 + echo "dotenv-keys: loading up dotenv keys from this directory" 48 + # TODO: Add source link since it is obviously copied from Stack Overflow. 49 + unamestr=$(uname) 50 + if [ "$unamestr" = 'Linux' ]; then 51 + export $(grep -v '^#' .env.keys | xargs -d '\n') 52 + elif [ "$unamestr" = 'FreeBSD' ] || [ "$unamestr" = 'Darwin' ]; then 53 + export $(grep -v '^#' .env.keys | xargs -0) 54 + fi 55 + 56 + export LOADED_DOTENV_KEYS=$PWD DOTENV_KEYS_LOADER=manual DOTENV_KEYS_LOADED=1 57 + elif [[ $1 == "unload" ]]; then 58 + echo "dotenv-keys: manually unloading dotenv keys" 59 + unset "${!DOTENV_PRIVATE_KEY*}" DOTENV_KEYS_LOADED DOTENV_KEYS_LOADER DOTENV_KEYS_LOADED 60 + else 61 + echo "dotenv-keys - .env.keys manager for dotenvx" 62 + echo "" 63 + echo "Commands:" 64 + echo " load - load keys from .env.keys in current directory into shell session" 65 + echo " unload - unload keys from shell session" 66 + fi 67 + }
+5 -1
.config/bash/tools/asdf.bashrc
··· 1 1 #!/usr/bin/env bash 2 2 3 - [ -s "$HOME/.asdf/asdf.sh" ] && source "$HOME/.asdf/asdf.sh" 3 + [ -s "$HOME/.asdf/asdf.sh" ] && source "$HOME/.asdf/asdf.sh" 4 + 5 + if [[ $ASDF_DIR ]]; then 6 + eval "$(direnv hook bash)" # Load up direnv hook after asdf 7 + fi
-1
.profile
··· 41 41 fi 42 42 43 43 if [[ $FF_BYOBU_ON_LOGIN != "" ]]; then 44 - _byobu_sourced=1 . /usr/bin/byobu-launch 2>/dev/null || true 45 44 fi