feat(shell): switched to antidote, asdf changes

This commit is contained in:
2024-11-22 17:53:46 +02:00
parent 6e69ec6410
commit 746646ae55
20 changed files with 132 additions and 72 deletions

1
.gitignore vendored
View File

@@ -28,4 +28,5 @@ config/gnupg/s
config/gnupg/private-keys-v1.d
config/nvim/spell/*
!config/nvim/spell/.gitkeep
antidote_plugins.zsh

4
.gitmodules vendored
View File

@@ -60,3 +60,7 @@
[submodule "asdf"]
path = local/bin/asdf
url = https://github.com/asdf-vm/asdf.git
[submodule "antidote"]
path = tools/antidote
url = https://github.com/mattmc3/antidote.git
shallow = true

View File

@@ -1,6 +1,7 @@
.git/**
config/cheat/cheatsheets/community/**
tools/dotbot/**
node_modules
tools/antidote/**
tools/dotbot-brew/**
tools/dotbot-include/**
node_modules
tools/dotbot/**

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
22.11.0

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.13.0

View File

@@ -1,2 +0,0 @@
python 3.13.0
nodejs 22.11.0

View File

@@ -17,6 +17,10 @@ git submodule add --name cheat-tldr \
-f https://github.com/ivuorinen/cheatsheet-tldr.git config/cheat/cheatsheets/tldr
git submodule add --name asdf \
-f https://github.com/asdf-vm/asdf.git local/bin/asdf
git submodule add --name antidote \
--depth 1 \
-f https://github.com/mattmc3/antidote.git tools/antidote \
# tmux plugin manager and plugins
git submodule add --name tmux/tmux-continuum \
@@ -43,6 +47,9 @@ for MODULE in $(git config --file .gitmodules --get-regexp path | awk '{ print $
git config "submodule.${MODULE}.ignore" all
done
# Mark certain repositories shallow
git config -f .gitmodules submodule.antidote.shallow true
# remove old submodules
[ -d "config/tmux/plugins/tpm" ] && rm -rf config/tmux/plugins/tpm
[ -d "config/tmux/plugins/tmux" ] && rm -rf config/tmux/plugins/tmux

View File

@@ -1 +1,2 @@
use node
use asdf

1
base/nvmrc Normal file
View File

@@ -0,0 +1 @@
lts/*

View File

@@ -1,7 +1,5 @@
asdf-plugin-manager 1.4.0
nodejs 23.1.0
golang 1.23.3
python 3.12.7
ruby 3.3.4
rust 1.82.0
direnv 2.35.0
@@ -14,7 +12,6 @@ editorconfig-checker 2.8.0
github-cli 2.61.0
hadolint 2.12.0
kubectl 1.31.2
pipx 1.7.1
pre-commit 4.0.1
ripgrep 14.1.1
shellcheck 0.10.0
@@ -26,3 +23,5 @@ yq 4.44.3
bats 1.11.0
gitleaks 8.18.4
delta 0.18.1
eza 0.20.8
sops 3.9.1

View File

@@ -13,17 +13,34 @@ export SHARED_SCRIPTS_SOURCED=0
source "$DOTFILES/config/shared.sh"
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
export ZDOTDIR="$DOTFILES/zsh"
ZSH_COMPDUMP="$XDG_CACHE_HOME/zsh/zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
eval "$(oh-my-posh init zsh --config "$DOTFILES/config/omp/own.toml")"
load_antidote()
{
[[ ! -d "$ANTIDOTE_DIR" ]] && {
git submodule add \
--name antidote \
--depth=1 \
-f https://github.com/mattmc3/antidote.git "${ANTIDOTE_DIR}"
git config -f .gitmodules submodule.antidote.shallow true
}
zstyle ':antidote:bundle' use-friendly-names 'yes'
zsh_plugins=${ANTIDOTE_PLUGINS}
[[ -f ${zsh_plugins}.txt ]] || touch ${zsh_plugins}.txt
# Lazy-load antidote from its functions directory.
FPATH="$ANTIDOTE_DIR/functions:$FPATH"
autoload -Uz antidote
# Generate a new static file whenever .zsh_plugins.txt is updated.
if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then
antidote bundle <${zsh_plugins}.txt >|${zsh_plugins}.zsh
fi
# Source your static plugins file.
source ${zsh_plugins}.zsh
}
# Function to load antigen if available
load_antigen()
{
@@ -55,10 +72,15 @@ load_antigen()
zstyle :omz:plugins:ssh-agent lazy yes
zstyle :omz:plugins:ssh-agent quiet yes
# nvm
zstyle ':omz:plugins:nvm' autoload yes
# z, the zsh version
export ZSHZ_DATA="$XDG_STATE_HOME/z"
antigen bundle z
antigen bundle nvm
# these should be always available
antigen bundle jreese/zsh-titles
antigen bundle brew
@@ -99,15 +121,11 @@ setup_tmux_window_name_plugin()
fi
}
load_antigen
# load_antigen
load_antidote
source_fzf_config
setup_tmux_window_name_plugin
if x-have antidot; then
eval "$(antidot init)"
fi
# Lando
export PATH="$HOME/.lando/bin${PATH+:$PATH}"; #landopath
x-have antidot && eval "$(antidot init)"
autoload -Uz compinit bashcompinit
compinit -d $ZSH_COMPDUMP

View File

@@ -7,16 +7,14 @@ delta https://github.com/andweeb/asdf-delta.git
direnv https://github.com/asdf-community/asdf-direnv.git 6ff3dbe
dotenv-linter https://github.com/wesleimp/asdf-dotenv-linter.git 1369f53
editorconfig-checker https://github.com/gabitchov/asdf-editorconfig-checker.git 585c1d5
eza https://github.com/lwiechec/asdf-eza.git 11f578d
fd https://gitlab.com/wt0f/asdf-fd.git 17d56e0
github-cli https://github.com/bartlomiejdanek/asdf-github-cli.git e0605b7
gitleaks https://github.com/jmcvetta/asdf-gitleaks.git 0cc0d7e
golang https://github.com/asdf-community/asdf-golang.git e2527a3
hadolint https://github.com/devlincashman/asdf-hadolint.git 335e230
kubectl https://github.com/asdf-community/asdf-kubectl.git 2fb3b57
nodejs https://github.com/asdf-vm/asdf-nodejs.git c36e6f0
pipx https://github.com/yozachar/asdf-pipx.git 31db618
pre-commit https://github.com/jonathanmorley/asdf-pre-commit.git 26bfc42
python https://github.com/asdf-community/asdf-python a3a0185
ripgrep https://gitlab.com/wt0f/asdf-ripgrep.git e836665
ruby https://github.com/asdf-vm/asdf-ruby.git 194fe45
rust https://github.com/code-lever/asdf-rust.git 95acf4f

View File

@@ -1,5 +1,4 @@
ansible
pipenv
semgrep
neovim
libtmux

View File

@@ -22,14 +22,6 @@ export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_
# Add zsh completions to FPATH, compinit will be called later
FPATH="$ZSH_COMPLETIONS:$FPATH"
# Load asdf
export ASDF_DIR="$XDG_BIN_HOME/asdf"
if [[ -d $ASDF_DIR ]]; then
[[ -d $ASDF_DIR/completions ]] && FPATH="$ASDF_DIR/completions:$FPATH"
[[ -d $ASDF_DIR/plugins ]] && FPATH="$ASDF_DIR/plugins:$FPATH"
source "$ASDF_DIR/asdf.sh"
fi
if ! command -v msg &> /dev/null; then
# Function to print messages if VERBOSE is enabled
# $1 - message (string)
@@ -303,6 +295,41 @@ hash shopt 2> /dev/null && shopt -s checkwinsize
export SHORT_HOST=$(hostname -s)
# asdf
# https://github.com/asdf-vm/asdf
msg "Setting up asdf configuration"
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
if [[ -d $ASDF_DIR ]]; then
[[ -d $ASDF_DIR/completions ]] && FPATH="$ASDF_DIR/completions:$FPATH"
[[ -d $ASDF_DIR/plugins ]] && FPATH="$ASDF_DIR/plugins:$FPATH"
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME}/asdf/asdfrc"
export ASDF_DATA_DIR="${ASDF_DIR}"
export ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME="${XDG_CONFIG_HOME}/asdf/plugin-versions"
export ASDF_LOG_FILE="${XDG_CACHE_HOME}/asdf/asdf.log"
export ASDF_FORCE_PREPEND=yes
## Default package files
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/cargo-packages"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/gem-packages"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/golang-packages"
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/python-packages"
## Plugin configuration
export ASDF_DIRENV_IGNORE_MISSING_PLUGINS=1
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY="latest_available"
## Add asdf to path
export PATH="${ASDF_DIR}/bin:${PATH}"
source "$ASDF_DIR/asdf.sh"
fi
# Antidote configuration
# https://getantidote.github.io/
msg "Setting up Antidote configuration"
export ANTIDOTE_DIR="$DOTFILES/tools/antidote"
export ANTIDOTE_PLUGINS="$XDG_CONFIG_HOME/zsh/antidote_plugins"
# Antigen configuration
# https://github.com/zsh-users/antigen/wiki/Configuration
msg "Setting up Antigen configuration"
@@ -320,28 +347,6 @@ export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
x-dc "$ANSIBLE_HOME"
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
# asdf
# https://github.com/asdf-vm/asdf
msg "Setting up asdf configuration"
export ASDF_DIR="${XDG_BIN_HOME}/asdf"
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME}/asdf/asdfrc"
export ASDF_DATA_DIR="${ASDF_DIR}"
export ASDF_PLUGIN_MANAGER_PLUGIN_VERSIONS_FILENAME="${XDG_CONFIG_HOME}/asdf/plugin-versions"
export ASDF_LOG_FILE="${XDG_CACHE_HOME}/asdf/asdf.log"
export ASDF_FORCE_PREPEND=yes
## Default package files
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/cargo-packages"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/gem-packages"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/golang-packages"
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME}/asdf/python-packages"
## Plugin configuration
export ASDF_DIRENV_IGNORE_MISSING_PLUGINS=1
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY="latest_available"
## Add asdf to path
export PATH="${ASDF_DIR}/bin:${PATH}"
# aws
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
@@ -436,6 +441,8 @@ export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
## for MichaelAquilina/zsh-autoswitch-virtualenv
export AUTOSWITCH_VIRTUAL_ENV_DIR="$WORKON_HOME"
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
x-have pyenv && eval "$(pyenv init -)"
# Rust / cargo
msg "Setting up Rust/Cargo configuration"

View File

@@ -20,3 +20,4 @@ auth.json
dfm.sh
.scannerwork
.phpactor.json
.zsh_history

View File

@@ -0,0 +1,31 @@
# This file is for Antidote plugins
# https://getantidote.github.io/usage
# vim: ft=ini
# set up Zsh completions with plugins
mattmc3/ez-compinit
zsh-users/zsh-completions kind:fpath path:src
# frameworks like oh-my-zsh are supported
getantidote/use-omz # handle OMZ dependencies
ohmyzsh/ohmyzsh path:lib # load OMZ's library
ohmyzsh/ohmyzsh path:plugins/colored-man-pages # load OMZ plugins
ohmyzsh/ohmyzsh path:plugins/colored-man-pages
ohmyzsh/ohmyzsh path:plugins/extract
ohmyzsh/ohmyzsh path:plugins/z
ohmyzsh/ohmyzsh path:plugins/eza
# Add some programmer plugins
ohmyzsh/ohmyzsh path:plugins/git
ohmyzsh/ohmyzsh path:plugins/golang
ohmyzsh/ohmyzsh path:plugins/python
ohmyzsh/ohmyzsh path:plugins/nvm
# Add core plugins that make Zsh a bit more like Fish
zsh-users/zsh-completions path:src kind:fpath
zdharma-continuum/fast-syntax-highlighting
# Add some plugins that are not in OMZ
jreese/zsh-titles
yuki-ycino/tms

View File

@@ -33,10 +33,7 @@ ASDF_INSTALLABLES=(
"golang:github.com/asdf-community/asdf-golang.git"
"hadolint:github.com/devlincashman/asdf-hadolint.git"
"kubectl:github.com/asdf-community/asdf-kubectl.git"
"nodejs:github.com/asdf-vm/asdf-nodejs.git"
"pipx:github.com/yozachar/asdf-pipx.git"
"pre-commit:github.com/jonathanmorley/asdf-pre-commit.git"
"python:github.com/asdf-community/asdf-python.git"
"ripgrep:gitlab.com/wt0f/asdf-ripgrep.git"
"rust:github.com/code-lever/asdf-rust.git"
"shellcheck:github.com/luizm/asdf-shellcheck.git"

View File

@@ -3,18 +3,15 @@
#
# shellcheck source=shared.sh
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
exit 0
eval "$DOTFILES/config/shared.sh"
# Enable verbosity with VERBOSE=1
VERBOSE="${VERBOSE:-0}"
msg "Starting to install npm packages"
msgr msg "Starting to install npm packages"
if ! command -v npm &> /dev/null; then
msg_err "npm could not be found."
msgr err "npm could not be found."
exit 0
fi
@@ -38,9 +35,9 @@ install_packages()
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
if npm ls -g -p "$pkg" &> /dev/null; then
msg_run_done "$pkg" "already installed"
msgr run_done "$pkg" "already installed"
else
msg_run "Installing npm package:" "$pkg"
msgr run "Installing npm package:" "$pkg"
npm install -g --no-fund --no-progress --no-timing "$pkg"
fi
echo ""
@@ -50,7 +47,7 @@ install_packages()
# Function to upgrade all global npm packages
upgrade_global_packages()
{
msg_run "Upgrading all global packages"
msgr run "Upgrading all global packages"
npm -g --no-progress --no-timing --no-fund outdated
npm -g --no-timing --no-fund upgrade
}
@@ -58,7 +55,7 @@ upgrade_global_packages()
# Function to clean npm cache
clean_npm_cache()
{
msg_run "Cleaning up npm cache"
msgr run "Cleaning up npm cache"
npm cache verify
npm cache clean --force
npm cache verify
@@ -69,7 +66,7 @@ main()
install_packages
upgrade_global_packages
clean_npm_cache
msg_yay "npm package installations complete"
msgr yay "npm package installations complete"
}
main "$@"

View File

@@ -3,9 +3,6 @@
#
# shellcheck source=shared.sh
echo "This file ($0) has been deprecated in favor of asdf. Please use asdf instead."
exit 0
source "${DOTFILES}/config/shared.sh"
# Enable verbosity with VERBOSE=1

1
tools/antidote Submodule

Submodule tools/antidote added at 64b786480f