Compare commits
92 Commits
b0e5c8e511
...
blesh
| Author | SHA1 | Date | |
|---|---|---|---|
| e8fca12861 | |||
|
|
d67b07d275 | ||
|
|
dda5fcc784 | ||
| b66b03bc78 | |||
| da7a244f95 | |||
| 4a461eb974 | |||
| a6257ed7d1 | |||
| d487ade6f2 | |||
| e24e8a1c49 | |||
| b1f6fc2f52 | |||
| 0f8a05b561 | |||
| 5f75d539b5 | |||
| dae19a88b4 | |||
| 6d78938056 | |||
| 6876cad10b | |||
| 3583770d94 | |||
| ddf5d19c51 | |||
| 86b85c4102 | |||
| b0aba1f3e1 | |||
| 033500c6bb | |||
| b3ac2a57df | |||
| cd4488ff24 | |||
| 189acc497d | |||
| 9016dfdaf3 | |||
| c3a9ed26f7 | |||
| 29db01cdd6 | |||
| 93a2836154 | |||
| 9fadf8b26f | |||
| f080a6cd5a | |||
| 4883342630 | |||
| ad9d32a1c2 | |||
| 20934a6a08 | |||
| 42ec31431e | |||
| db76feed3e | |||
| 82d5a313c4 | |||
| aa7b4417d0 | |||
| e6ac283459 | |||
| b060cb0f83 | |||
| e12d4ae431 | |||
| e0176bec1e | |||
| c2d137749d | |||
| 4d1f34dfe5 | |||
| c0bf68b9e7 | |||
| fa0d2e7077 | |||
| 9dc7288b77 | |||
| 99b5fd8319 | |||
| 9027cd9bc6 | |||
| dec1d4009c | |||
| f44ef83e66 | |||
| da3b0e4ab5 | |||
| 6935843cee | |||
| 0ce1d88173 | |||
| 1019f48597 | |||
| 0165d9bad2 | |||
| 17be8f5726 | |||
| 8fc91ea898 | |||
| 6cdd6cea15 | |||
| 8c65fc2c45 | |||
| c3ab44d1e2 | |||
| 1829f987e9 | |||
| 16bbf912c1 | |||
| 4d5084e5aa | |||
| 39a666c7b7 | |||
| 223fd65981 | |||
| 94083316f6 | |||
| 4ef1d15958 | |||
| 97a4f9fa91 | |||
| 0f59972f1b | |||
| 1961395687 | |||
| c394c74421 | |||
| 3636fb6d07 | |||
| ab6350f15a | |||
| 54a937f610 | |||
| 709e9a7dd7 | |||
| 44cf82a669 | |||
| fd08d4ed13 | |||
| ae09d9af9d | |||
| 3ce108cc40 | |||
| 1e340b2a52 | |||
| f9040142cd | |||
| 8de18fd135 | |||
| 673500eea6 | |||
| 82db8eb050 | |||
| f409105b58 | |||
| 9780b18e08 | |||
| 582ec5aba5 | |||
| cd149a2cf5 | |||
| b2c9f720ab | |||
| 381a5b8f05 | |||
| fc9a068d01 | |||
| ce8f3b4463 | |||
| f9a84f9b58 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -61,3 +61,6 @@
|
||||
[submodule "vim/.vim/nvim-bundle/zk-nvim"]
|
||||
path = vim/.vim/nvim-bundle/zk-nvim
|
||||
url = https://github.com/zk-org/zk-nvim.git
|
||||
[submodule "vim/.vim/bundle/vim-helm"]
|
||||
path = vim/.vim/bundle/vim-helm
|
||||
url = https://github.com/towolf/vim-helm.git
|
||||
|
||||
@@ -17,6 +17,9 @@ apply_dotfile sh
|
||||
apply_dotfile readline
|
||||
apply_dotfile screen
|
||||
|
||||
apply_dotfile git
|
||||
apply_dotfile xdg
|
||||
|
||||
apply_dotfile vim
|
||||
|
||||
apply_dotfile ruby
|
||||
|
||||
105
bash/.bashrc
105
bash/.bashrc
@@ -1,5 +1,46 @@
|
||||
#{- ~/.bashrc -}#
|
||||
|
||||
#{- SOURCING -}#
|
||||
|
||||
# Source profile, if it hasn't already been loaded
|
||||
if [ -z "$__PROFILE_DONE" ]; then
|
||||
. $HOME/.profile
|
||||
fi
|
||||
|
||||
# Source .env to extend with secret/sensitive environment variables if it exists
|
||||
if [ -r "$HOME/.env" ]; then
|
||||
. "$HOME/.env"
|
||||
fi
|
||||
|
||||
if [ -r "$HOME/.config/xdg/env" ]; then
|
||||
. "$HOME/.config/xdg/env"
|
||||
fi
|
||||
|
||||
# Source aliases, if they exist
|
||||
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
||||
. "$HOME/.aliases"
|
||||
fi
|
||||
|
||||
# Source private aliases, if they exist
|
||||
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
||||
. "$HOME/.private_aliases"
|
||||
fi
|
||||
|
||||
# Source functions, if they exist
|
||||
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
||||
. "$HOME/.functions"
|
||||
fi
|
||||
|
||||
# Source private functions, if they exist
|
||||
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
||||
. "$HOME/.private_functions"
|
||||
fi
|
||||
|
||||
if blesh-available; then
|
||||
# blesh-activate
|
||||
:
|
||||
fi
|
||||
|
||||
#{- PROMPT -}#
|
||||
|
||||
if which tput &> /dev/null && tput bold &> /dev/null; then
|
||||
@@ -20,7 +61,6 @@ else
|
||||
no_color="\[\033[0m\]"
|
||||
fi
|
||||
|
||||
|
||||
export PS1="${green}"'\$'"${no_color} "
|
||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||
@@ -55,7 +95,7 @@ if which direnv &> /dev/null; then
|
||||
PS1=${ORIG_PS1}
|
||||
fi
|
||||
}
|
||||
PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND"
|
||||
prompt_command_prepend "update_prompt"
|
||||
fi
|
||||
|
||||
# Continuation Prompt: "> " in cyan
|
||||
@@ -65,8 +105,14 @@ export PS4="${blue}#${no_color} "
|
||||
|
||||
#{- HISTORY -}#
|
||||
|
||||
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||
if blesh-attached; then
|
||||
bleopt history_share=1
|
||||
else
|
||||
prompt_command_prepend "history -r"
|
||||
prompt_command_prepend "history -c"
|
||||
prompt_command_prepend "history -w"
|
||||
prompt_command_prepend "history -n"
|
||||
fi
|
||||
export HISTFILE="$HOME/.history/bash"
|
||||
export HISTTIMEFORMAT="%F %T "
|
||||
export HISTCONTROL="erasedups:ignoreboth"
|
||||
@@ -93,42 +139,17 @@ log_bash_persistent_history()
|
||||
fi
|
||||
}
|
||||
|
||||
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||
prompt_command_prepend "log_bash_persistent_history"
|
||||
|
||||
|
||||
#{- SOURCING -}#
|
||||
|
||||
|
||||
# Source profile, if it hasn't already been loaded
|
||||
if [ -z "$__PROFILE_DONE" ]; then
|
||||
. $HOME/.profile
|
||||
fi
|
||||
|
||||
# Source .env to extend with secret/sensitive environment variables if it exists
|
||||
if [ -r "$HOME/.env" ]; then
|
||||
. "$HOME/.env"
|
||||
fi
|
||||
|
||||
|
||||
# Source aliases, if they exist
|
||||
if [ -f "$HOME/.aliases" ] && [ -r "$HOME/.aliases" ]; then
|
||||
. "$HOME/.aliases"
|
||||
fi
|
||||
|
||||
# Source private aliases, if they exist
|
||||
if [ -f "$HOME/.private_aliases" ] && [ -r "$HOME/.private_aliases" ]; then
|
||||
. "$HOME/.private_aliases"
|
||||
fi
|
||||
|
||||
# Source functions, if they exist
|
||||
if [ -f "$HOME/.functions" ] && [ -r "$HOME/.functions" ]; then
|
||||
. "$HOME/.functions"
|
||||
fi
|
||||
|
||||
# Source private functions, if they exist
|
||||
if [ -f "$HOME/.private_functions" ] && [ -r "$HOME/.private_functions" ]; then
|
||||
. "$HOME/.private_functions"
|
||||
fi
|
||||
# Source bash completion, this file will then lazy load all other completions
|
||||
source_completions() {
|
||||
if [ -r "/usr/share/bash-completion/bash_completion" ]; then
|
||||
. "/usr/share/bash-completion/bash_completion"
|
||||
elif [ -r "/etc/bash_completion" ]; then
|
||||
. "/etc/bash_completion"
|
||||
fi
|
||||
}
|
||||
source_completions
|
||||
|
||||
# Preserve the usefulness of set -x by attempting to hide everything that
|
||||
# happens in prompt_command
|
||||
@@ -145,8 +166,12 @@ preserve_xtrace_reset() {
|
||||
fi
|
||||
} 2>/dev/null
|
||||
|
||||
PROMPT_COMMAND="preserve_xtrace; $PROMPT_COMMAND preserve_xtrace_reset"
|
||||
prompt_command_prepend "preserve_xtrace"
|
||||
prompt_command_append "preserve_xtrace_reset"
|
||||
|
||||
if $(which direnv &> /dev/null); then
|
||||
# Only if direnv isn't already defined in our prompt_command
|
||||
if ! grep -q _direnv_hook <<< $PROMPT_COMMAND; then
|
||||
eval "$(direnv hook bash)"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -18,6 +18,85 @@ maths()
|
||||
|
||||
cat_with_newline()
|
||||
{
|
||||
cat "$@" && echo
|
||||
\cat "$@" && echo
|
||||
}
|
||||
alias cat="cat_with_newline"
|
||||
|
||||
k_prompt()
|
||||
{
|
||||
set -x
|
||||
if [ -z ${KUBE_PROMPT+x} ]; then
|
||||
export KUBE_PROMPT=1
|
||||
else
|
||||
unset KUBE_PROMPT
|
||||
fi
|
||||
set +x
|
||||
}
|
||||
|
||||
kube_prompt()
|
||||
{
|
||||
set -x
|
||||
if ! [ -z ${KUBE_PROMPT+x} ]; then
|
||||
context=$(\cat ${KUBECONFIG} \
|
||||
| grep "current-context: " \
|
||||
| sed "s/current-context: //")
|
||||
echo {$context}
|
||||
fi
|
||||
set +x
|
||||
}
|
||||
|
||||
g_prompt()
|
||||
{
|
||||
if ! [ -z ${GIT_PROMPT+x} ]; then
|
||||
export GIT_PROMPT=1
|
||||
else
|
||||
unset GIT_PROMPT
|
||||
fi
|
||||
}
|
||||
|
||||
git_prompt()
|
||||
{
|
||||
if ! [ -z ${GIT_PROMPT+x} ]; then
|
||||
# Determine if we are in a git repository
|
||||
if git rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo [$branch]
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_command_append() {
|
||||
arg=${1}
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+"$PROMPT_COMMAND; "}"${arg}"
|
||||
}
|
||||
|
||||
prompt_command_prepend() {
|
||||
arg=${1}
|
||||
PROMPT_COMMAND="${arg}"${PROMPT_COMMAND:+"; $PROMPT_COMMAND"}
|
||||
}
|
||||
|
||||
blesh-activate()
|
||||
{
|
||||
BLESH_PATH=$HOME/.nix-profile/share/blesh/ble.sh
|
||||
if [ -r $BLESH_PATH ]; then
|
||||
[[ $- == *i* ]] && . $HOME/.nix-profile/share/blesh/ble.sh
|
||||
[[ ! ${BLE_VERSION-} ]] || ble-attach
|
||||
fi
|
||||
}
|
||||
|
||||
blesh-available() {
|
||||
BLESH_PATH=$HOME/.nix-profile/share/blesh/ble.sh
|
||||
if [ -r $BLESH_PATH ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
blesh-attached () {
|
||||
if [ -z ${BLE_VERSION:+x} ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
25
git/.config/git/config
Normal file
25
git/.config/git/config
Normal file
@@ -0,0 +1,25 @@
|
||||
[branch]
|
||||
sort = -committerdate
|
||||
[column]
|
||||
ui = auto
|
||||
[tag]
|
||||
sort = version:refname
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[diff]
|
||||
algorithm = histogram
|
||||
colorMoved = plain
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
[push]
|
||||
default = simple
|
||||
autoSetupRemote = true
|
||||
followTags = true
|
||||
[fetch]
|
||||
prune = true
|
||||
pruneTags = true
|
||||
all = true
|
||||
[commit]
|
||||
verbose = true
|
||||
[core]
|
||||
excludefiles = ~/.config/git/ignore
|
||||
13
install.sh
13
install.sh
@@ -6,6 +6,7 @@ set -ex
|
||||
echo "PWD: $PWD"
|
||||
# Coder dotfiles (and most other ways of doing this) will not do a recursive clone, so do that in install script.
|
||||
git submodule init && git submodule update
|
||||
|
||||
# Match case insensitively to make things easier for this part
|
||||
shopt -s nocasematch
|
||||
|
||||
@@ -14,13 +15,21 @@ echo "Installing dotfiles..."
|
||||
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
|
||||
installers/install-nix.sh
|
||||
installers/install-nix-packages-flake.sh
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
|
||||
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
|
||||
fi
|
||||
elif [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ]; then
|
||||
echo "Detected OS as Ubuntu, using apt";
|
||||
sudo apt-get update;
|
||||
sudo apt-get install -y stow;
|
||||
installers/install-nix.sh
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
|
||||
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
|
||||
fi
|
||||
elif [ -f /etc/os-release ]; then
|
||||
echo "Idenitfying OS to install GNU stow..."
|
||||
if grep -q -i debian /etc/os-release; then
|
||||
|
||||
@@ -11,6 +11,8 @@ ARCHIVE_PATH="${FLAKE_PATH}/archive.nar"
|
||||
if ! which nix &>/dev/null; then
|
||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
|
||||
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
|
||||
else
|
||||
echo "Nix isn't available. Exiting now!"
|
||||
exit 1
|
||||
|
||||
@@ -7,8 +7,12 @@ set -e
|
||||
set -x
|
||||
|
||||
# Abort installation if Nix is already installed
|
||||
if [ -d /nix ]; then
|
||||
if [ -d /nix/store ]; then
|
||||
exit 0
|
||||
elif [ -d /nix ] && ! [ -O /nix ]; then
|
||||
# If we don't own /nix use sudo to chown it.
|
||||
# If we can't sudo then nothing we do here will work so we just let this fail
|
||||
sudo chown $UID /nix
|
||||
fi
|
||||
|
||||
# Workaround to make a single user install work as root
|
||||
@@ -28,6 +32,8 @@ cat << EOF > ~/.bashrc
|
||||
# Source nix if it's installed
|
||||
if [ -r ~/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
|
||||
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
|
||||
fi
|
||||
EOF
|
||||
|
||||
@@ -40,6 +46,7 @@ NIX_CONF_FILE=${NIX_CONF_DIR}/nix.conf
|
||||
mkdir -p ${NIX_CONF_DIR}
|
||||
cat <<EOF > ${NIX_CONF_FILE}
|
||||
experimental-features = flakes nix-command
|
||||
use-xdg-base-directories = true
|
||||
EOF
|
||||
# Conditionally add a link to system certificates for nix
|
||||
if [ -f /etc/ssl/certs/ca-certificates.crt ]; then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Defaults to using bash as the shell
|
||||
defshell bash
|
||||
defshell $SHELL
|
||||
# Extend scrollback buffer
|
||||
defscrollback 100000
|
||||
# Disable startup message
|
||||
@@ -50,4 +50,6 @@ export HISTFILESIZE=10000
|
||||
|
||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
|
||||
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
|
||||
fi
|
||||
|
||||
1
vim/.vim/bundle/vim-helm
Submodule
1
vim/.vim/bundle/vim-helm
Submodule
Submodule vim/.vim/bundle/vim-helm added at ae1ebc160d
14
xdg/.config/xdg/env
Normal file
14
xdg/.config/xdg/env
Normal file
@@ -0,0 +1,14 @@
|
||||
export XDG_DATA_HOME="${HOME}/.local/share"
|
||||
export XDG_CONFIG_HOME="${HOME}/.config"
|
||||
export XDG_STATE_HOME="${HOME}/.local/state"
|
||||
export XDG_CACHE_HOME="${HOME}/.cache"
|
||||
|
||||
# Set environment variables to force programs to respect XDG that do not by default
|
||||
export SCREENRC="${XDG_CONFIG_HOME}/screen/screenrc"
|
||||
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
|
||||
export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history
|
||||
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
export IRBRC="$XDG_CONFIG_HOME/irb/irbrc"
|
||||
|
||||
export KUBECONFIG="${XDG_CONFIG_HOME}/kube/config"
|
||||
mkdir -p "$(dirname ${KUBECONFIG})"
|
||||
13
xdg/.local/bin/enable-xdg-legacy-support
Executable file
13
xdg/.local/bin/enable-xdg-legacy-support
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# For older systems that don't support newer versions of programs that may
|
||||
# support XDG config paths natively we have to symlink to the new paths from
|
||||
# the expected locations of the older paths.
|
||||
|
||||
# This can also be used to support migrations from systems before we started XDGifying
|
||||
|
||||
ln -s "${XDG_CONFIG_HOME}/screen/screenrc" "${HOME}/.screenrc"
|
||||
ln -s "${XDG_DATA_HOME}/.gnupg" "${HOME}/.gnupg"
|
||||
ln -s "${XDG_DATA_HOME}/mysql_history" "${HOME}/.mysql_history"
|
||||
ln -s "${XDG_CONFIG_HOME}/readline/inputrc" "${HOME}/.inputrc"
|
||||
ln -s "${XDG_CONFIG_HOME}/irb/irbc" "${HOME}/.irbrc"
|
||||
ln -s "${XDG_CONFIG_HOME}/kube/config" "${HOME}/.kubeconfig"
|
||||
Reference in New Issue
Block a user