Compare commits
86
Commits
master
..
a07797c281
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a07797c281 | ||
|
|
d0a7049bd8 | ||
|
|
b0e5c8e511 | ||
|
|
957de95e36 | ||
|
|
7a243ee185 | ||
|
|
e32ed8a7b7 | ||
|
|
1481fcc948 | ||
|
|
4afcb4523a | ||
|
|
db92ba133b | ||
|
|
0a7f1e193a | ||
|
|
edf8584f2a | ||
|
|
30ff982bff | ||
|
|
da4d9dc4ce | ||
|
|
37d71e1e43 | ||
|
|
7f0fd90dcc | ||
|
|
33be0bbd0a | ||
|
|
630160e1e9 | ||
|
|
27d202b0c2 | ||
|
|
4353a79f16 | ||
|
|
5ba18a9a7f | ||
|
|
157cb56eea | ||
|
|
6d2ebcb505 | ||
|
|
b3cecbaf22 | ||
|
|
f72d1050d3 | ||
|
|
c2e40ce9df | ||
|
|
6c09b2c11b | ||
|
|
8ff319f8de | ||
|
|
561297d305 | ||
|
|
7fbe76430d | ||
|
|
ed643a06f9 | ||
|
|
c460081637 | ||
|
|
2f971627bd | ||
|
|
55141b696b | ||
|
|
bee634eb79 | ||
|
|
bc63202425 | ||
|
|
119c751ea3 | ||
|
|
722352e607 | ||
|
|
e1d39feb7d | ||
|
|
f64da797ce | ||
|
|
ec19718182 | ||
|
|
6e88e2b333 | ||
|
|
4c312cfa58 | ||
|
|
11e8bf4bec | ||
|
|
a16b49a394 | ||
|
|
829e53d3cc | ||
|
|
e02cdd0b66 | ||
|
|
c2ebab9a41 | ||
|
|
5426e96bed | ||
|
|
51b8138cf3 | ||
|
|
790c132e07 | ||
|
|
008d3720ff | ||
|
|
85cee95c2e | ||
|
|
7360e32a08 | ||
|
|
c2286bb299 | ||
|
|
4c48565a8f | ||
|
|
edd3b72430 | ||
|
|
772da66b96 | ||
|
|
ac168d66d7 | ||
|
|
8937b9f566 | ||
|
|
c73a495540 | ||
|
|
406c50b4a5 | ||
|
|
4360067486 | ||
|
|
b156901695 | ||
|
|
bc00f7a310 | ||
|
|
16545b322f | ||
|
|
dafc207f96 | ||
|
|
f81ee2834a | ||
|
|
b7ce819dba | ||
|
|
f7b5147450 | ||
|
|
6246e75d81 | ||
|
|
d901efe31a | ||
|
|
e15f254143 | ||
|
|
fa7af5ee1f | ||
|
|
819c41de45 | ||
|
|
c97ef61d30 | ||
|
|
0d5d35d5e1 | ||
|
|
8c379c558a | ||
|
|
8ce45fc87c | ||
|
|
ed9e0d4419 | ||
|
|
dd35fe3b20 | ||
|
|
c26f6a6bf5 | ||
|
|
08713c254f | ||
|
|
2d14e91f81 | ||
|
|
8dda8c7fbc | ||
|
|
7d67ff0662 | ||
|
|
a2076fd6f1 |
@@ -61,6 +61,3 @@
|
||||
[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
|
||||
|
||||
+11
-29
@@ -5,11 +5,6 @@ apply_dotfile() {
|
||||
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
||||
}
|
||||
|
||||
revert_dotfile() {
|
||||
directory_to_stow="${1}"
|
||||
stow -D -t "${HOME}" "${directory_to_stow}"
|
||||
}
|
||||
|
||||
# Adopt will change the files in stow to match existing files.
|
||||
# We don't want this, we just want to handle existing files gracefully.
|
||||
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
||||
@@ -17,35 +12,22 @@ restore_from_adoption() {
|
||||
git restore .
|
||||
}
|
||||
|
||||
mode_command=${1:-apply}
|
||||
if [ "${mode_command}" != "apply" ] && [ "${mode_command}" != "revert" ]; then
|
||||
echo "$0: mode command ("'${1}'") must be apply or revert" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
apply_dotfile bash
|
||||
apply_dotfile sh
|
||||
apply_dotfile readline
|
||||
apply_dotfile screen
|
||||
|
||||
operation() {
|
||||
${mode_command}_dotfile ${1}
|
||||
}
|
||||
apply_dotfile git
|
||||
apply_dotfile xdg
|
||||
|
||||
# Create .local/bin to prevent tree folding
|
||||
mkdir -p ~/.local/bin
|
||||
apply_dotfile vim
|
||||
|
||||
operation bash
|
||||
operation sh
|
||||
operation readline
|
||||
operation screen
|
||||
|
||||
operation git
|
||||
operation xdg
|
||||
|
||||
operation vim
|
||||
|
||||
operation ruby
|
||||
operation python
|
||||
apply_dotfile ruby
|
||||
apply_dotfile python
|
||||
|
||||
# Only if inside a coder instance
|
||||
if [ -n "${CODER}" ]; then
|
||||
operation gnupg
|
||||
apply_dotfile gnupg
|
||||
fi
|
||||
|
||||
# Check that SSH version is above 9.2 (where EnableEscapeCommandline was added) before conditionally adding
|
||||
@@ -56,6 +38,6 @@ cat <<CONFIG > ssh/.ssh/extra.conf
|
||||
EnableEscapeCommandline yes
|
||||
CONFIG
|
||||
fi
|
||||
operation ssh
|
||||
apply_dotfile ssh
|
||||
|
||||
restore_from_adoption
|
||||
|
||||
+41
-56
@@ -1,41 +1,5 @@
|
||||
#{- ~/.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
|
||||
|
||||
#{- PROMPT -}#
|
||||
|
||||
if which tput &> /dev/null && tput bold &> /dev/null; then
|
||||
@@ -56,6 +20,7 @@ else
|
||||
no_color="\[\033[0m\]"
|
||||
fi
|
||||
|
||||
|
||||
export PS1="${green}"'\$'"${no_color} "
|
||||
export DIRENV_PS1="${red}"'\$'"${no_color} "
|
||||
export NIX_SHELL_PS1="${blue}"'λ'"${no_color} "
|
||||
@@ -90,7 +55,7 @@ if which direnv &> /dev/null; then
|
||||
PS1=${ORIG_PS1}
|
||||
fi
|
||||
}
|
||||
prompt_command_prepend update_prompt
|
||||
PROMPT_COMMAND="update_prompt; $PROMPT_COMMAND"
|
||||
fi
|
||||
|
||||
# Continuation Prompt: "> " in cyan
|
||||
@@ -100,10 +65,7 @@ export PS4="${blue}#${no_color} "
|
||||
|
||||
#{- HISTORY -}#
|
||||
|
||||
prompt_command_prepend "history -r"
|
||||
prompt_command_prepend "history -c"
|
||||
prompt_command_prepend "history -w"
|
||||
prompt_command_prepend "history -n"
|
||||
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"
|
||||
export HISTFILE="$HOME/.history/bash"
|
||||
export HISTTIMEFORMAT="%F %T "
|
||||
@@ -131,18 +93,45 @@ log_bash_persistent_history()
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_command_prepend "log_bash_persistent_history"
|
||||
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||
|
||||
|
||||
# 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
|
||||
#{- 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
|
||||
|
||||
# Preserve the usefulness of set -x by attempting to hide everything that
|
||||
# happens in prompt_command
|
||||
@@ -159,12 +148,8 @@ preserve_xtrace_reset() {
|
||||
fi
|
||||
} 2>/dev/null
|
||||
|
||||
prompt_command_prepend preserve_xtrace
|
||||
prompt_command_append preserve_xtrace_reset
|
||||
PROMPT_COMMAND="preserve_xtrace; $PROMPT_COMMAND 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
|
||||
|
||||
+1
-54
@@ -18,59 +18,6 @@ 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"}
|
||||
}
|
||||
|
||||
+2
-11
@@ -6,7 +6,6 @@ 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
|
||||
|
||||
@@ -15,21 +14,13 @@ echo "Installing dotfiles..."
|
||||
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
|
||||
installers/install-nix.sh
|
||||
installers/install-nix-packages-flake.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
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
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
|
||||
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
|
||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
||||
elif [ -f /etc/os-release ]; then
|
||||
echo "Idenitfying OS to install GNU stow..."
|
||||
if grep -q -i debian /etc/os-release; then
|
||||
|
||||
@@ -11,8 +11,6 @@ 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,12 +7,8 @@ set -e
|
||||
set -x
|
||||
|
||||
# Abort installation if Nix is already installed
|
||||
if [ -d /nix/store ]; then
|
||||
if [ -d /nix ]; 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
|
||||
@@ -32,8 +28,6 @@ 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
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Defaults to using bash as the shell
|
||||
defshell $SHELL
|
||||
defshell bash
|
||||
# Extend scrollback buffer
|
||||
defscrollback 100000
|
||||
# Disable startup message
|
||||
|
||||
@@ -50,6 +50,4 @@ 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
-1
Submodule vim/.vim/bundle/ale updated: c59c0d1a57...6db58b3379
Submodule vim/.vim/bundle/commentary updated: 64a654ef4a...c4b8f52cbb
+1
-1
Submodule vim/.vim/bundle/eunuch updated: e86bb794a1...8fb3904be2
Submodule vim/.vim/bundle/filetype-nix updated: 7235c7ce2c...e25cd0f2e5
+1
-1
Submodule vim/.vim/bundle/fugitive updated: 3b753cf8c6...dac8e5c2d8
+1
-1
Submodule vim/.vim/bundle/sleuth updated: be69bff867...1cc4557420
+1
-1
Submodule vim/.vim/bundle/slime updated: 2cfdc3b24e...87988b173b
Submodule vim/.vim/bundle/vim-helm deleted from 2c8525fd98
@@ -9,6 +9,3 @@ 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})"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/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