Select the types of activity you want to include in your feed.
Personal dotfiles for Linux, mostly for Nixpkgs/NixOS-based and Termux setups. Mirrored using GitLab's push mirroring feature.
gitlab.com/andreijiroh-dev/dotfiles
···6363 source "$HOME/.bashbox/env"
6464fi
65656666-# handle hostname generation for importing host-specific configs
6767-# TODO: Handle detection when we don't have WSL_* variables on tmux shell sessions
6666+# Formerly: handle hostname generation for importing host-specific configs
6767+# TODO: Handle detection across distributions without chaos, especially where
6868+# Nix is installed (not NixOS)
6869if [[ $WSL_DISTRO_NAME ]] && [[ $WSL_INTEROP ]]; then
6970 HOSTNAME_BASH="$(cat /etc/hostname)-wsl-${WSL_DISTRO_NAME}"
7071 export WSL=1 # similar to CODESPACES and GITPOD_WORKSPACE_ID vars
+1-1
.config/bash/aliases
···11# General
22alias clear="printf '\033c'" # faster than ncurses clear by a lot
33alias c='clear'
44-alias bashrc="nano ~/.bashrc && source ~/.bashrc"
44+alias bashrc="${EDITOR:-"nano"} ~/.bashrc && source ~/.bashrc"
55# LS
66alias ls='ls --color=auto -FAh'
77alias ll='ls -l'
+2-1
.config/bash/bashrc
···6868# ~/.bash_aliases, instead of adding them here directly.
6969# See /usr/share/doc/bash-doc/examples in the bash-doc package.
70707171-source "${HOME}/.config/aliases"
7171+source "${HOME}/.config/bash/aliases"
7272source "${HOME}/.config/bash/tools/automated-deploy.bashrc"
7373+source "${HOME}/.config/bash/functions"
73747475# enable programmable completion features (you don't need to enable
7576# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+67
.config/bash/functions
···11+#!/usr/bin/env bash
22+# shellcheck disable=SC2046
33+44+# handle .env.keys detection
55+_load_env_keys() {
66+ if [[ "$LAST_DOTENV_DIR" == "$PWD" ]]; then
77+ return
88+ elif [[ "$LAST_DOTENV_DIR" != "$PWD" ]] && [ -f "$LAST_DOTENV_DIR/.env.keys" ]; then
99+ return
1010+ fi
1111+1212+ if [ -f "$PWD/.env.keys" ] && [[ "$LOADED_DOTENV_KEYS" != "1" ]]; then
1313+ echo "dotenv-keys: loading up dotenv keys from this directory"
1414+1515+ # TODO: Add source link since it is obviously copied from Stack Overflow.
1616+ unamestr=$(uname)
1717+ if [ "$unamestr" = 'Linux' ]; then
1818+ export $(grep -v '^#' .env.keys | xargs -d '\n')
1919+ elif [ "$unamestr" = 'FreeBSD' ] || [ "$unamestr" = 'Darwin' ]; then
2020+ export $(grep -v '^#' .env.keys | xargs -0)
2121+ fi
2222+2323+ export DOTENV_KEYS_LOADED=1 LAST_DOTENV_DIR=$PWD DOTENV_KEYS_LOADER=auto
2424+ elif [ ! -f "$PWD/.env.keys" ] && [[ "$LOADED_DOTENV_KEYS" == "1" ]]; then
2525+ echo "dotenv-keys: unloading dotenv keys"
2626+ unset "${!DOTENV_PRIVATE_KEYS*}" DOTENV_KEYS_LOADED DOTENV_KEYS_LOADER
2727+ export LAST_DOTENV_DIR=$PWD
2828+ fi
2929+}
3030+3131+if [[ ";${PROMPT_COMMAND[*]:-};" != *";_load_env_keys;"* ]]; then
3232+ if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then
3333+ PROMPT_COMMAND=(_load_env_keys "${PROMPT_COMMAND[@]}")
3434+ else
3535+ PROMPT_COMMAND="_load_env_keys${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
3636+ fi
3737+fi
3838+3939+# Allow manual access to .env.keys, even without the keys autoloader.
4040+dotenv-keys() {
4141+ if [[ $1 == "load" ]]; then
4242+ if [ ! -f "$PWD/.env.keys" ]; then
4343+ echo "error: missing dotenv encryption keys"
4444+ return 1
4545+ fi
4646+4747+ echo "dotenv-keys: loading up dotenv keys from this directory"
4848+ # TODO: Add source link since it is obviously copied from Stack Overflow.
4949+ unamestr=$(uname)
5050+ if [ "$unamestr" = 'Linux' ]; then
5151+ export $(grep -v '^#' .env.keys | xargs -d '\n')
5252+ elif [ "$unamestr" = 'FreeBSD' ] || [ "$unamestr" = 'Darwin' ]; then
5353+ export $(grep -v '^#' .env.keys | xargs -0)
5454+ fi
5555+5656+ export LOADED_DOTENV_KEYS=$PWD DOTENV_KEYS_LOADER=manual DOTENV_KEYS_LOADED=1
5757+ elif [[ $1 == "unload" ]]; then
5858+ echo "dotenv-keys: manually unloading dotenv keys"
5959+ unset "${!DOTENV_PRIVATE_KEY*}" DOTENV_KEYS_LOADED DOTENV_KEYS_LOADER DOTENV_KEYS_LOADED
6060+ else
6161+ echo "dotenv-keys - .env.keys manager for dotenvx"
6262+ echo ""
6363+ echo "Commands:"
6464+ echo " load - load keys from .env.keys in current directory into shell session"
6565+ echo " unload - unload keys from shell session"
6666+ fi
6767+}