feat(asdf): removal of asdf

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-02-25 10:35:13 +02:00
parent dfbdb89aca
commit 4f2b47d5c3
12 changed files with 16 additions and 324 deletions

6
.gitmodules vendored
View File

@@ -74,11 +74,6 @@
url = https://github.com/erikw/tmux-dark-notify.git
ignore = dirty
[submodule "asdf"]
path = local/asdf
url = https://github.com/asdf-vm/asdf.git
ignore = dirty
[submodule "antidote"]
path = tools/antidote
url = https://github.com/mattmc3/antidote.git
@@ -88,4 +83,3 @@
[submodule "dotbot-asdf"]
path = tools/dotbot-asdf
url = https://github.com/sobolevn/dotbot-asdf
ignore = dirty

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
git submodule sync --recursive
# dotbot and plugins
git submodule add --name dotbot \
-f https://github.com/anishathalye/dotbot.git tools/dotbot
@@ -17,8 +19,6 @@ git submodule add --name cheat-community \
-f https://github.com/cheat/cheatsheets.git config/cheat/cheatsheets/community
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/asdf
git submodule add --name antidote \
--depth 1 \
-f https://github.com/mattmc3/antidote.git tools/antidote
@@ -54,18 +54,20 @@ git config -f .gitmodules submodule.antidote.shallow true
# remove old submodules
folders=(
"config/tmux/plugins/tpm"
"config/tmux/plugins/tmux"
"config/tmux/plugins/tmux-menus"
"config/tmux/plugins/tmux-resurrect"
"tools/dotbot-crontab"
"tools/dotbot-snap"
"config/nvim-kickstart"
"local/bin/asdf"
"config/tmux/plugins/tpm"
"config/tmux/plugins/tmux"
"config/tmux/plugins/tmux-menus"
"config/tmux/plugins/tmux-resurrect"
"tools/dotbot-crontab"
"tools/dotbot-snap"
"config/nvim-kickstart"
"local/bin/asdf"
"local/asdf"
"tools/dotbot-asdf"
)
for folder in "${folders[@]}"; do
[ -d "$folder" ] && \
rm -rf "$folder" && \
msgr run_done "Removed old submodule $folder"
[ -d "$folder" ] \
&& rm -rf "$folder" \
&& msgr run_done "Removed old submodule $folder"
done

View File

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

View File

@@ -1,19 +0,0 @@
golang 1.23.4
rust 1.83.0
direnv 2.35.0
fd 10.2.0
1password-cli 2.30.3
age 1.2.1
dotenv-linter 3.3.0
editorconfig-checker 2.8.0
github-cli 2.64.0
hadolint 2.12.0
kubectl 1.32.0
pre-commit 4.0.1
ripgrep 14.1.1
shellcheck 0.10.0
shfmt 3.10.0
terragrunt 0.71.1
tf-summarize 0.3.14
yamllint 1.35.1
yq 4.44.6

View File

@@ -12,7 +12,6 @@ export PATH="$HOME/.local/bin:$DOTFILES/local/bin:$LOCAL_SHARE/nvim/mason/bin:$L
export SHARED_SCRIPTS_SOURCED=0
source "$DOTFILES/config/shared.sh"
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"
# zsh completions directory
[ -z "$ZSH_COMPLETIONS" ] && export ZSH_COMPLETIONS="$XDG_CONFIG_HOME/zsh/completion"
@@ -51,10 +50,6 @@ setup_tmux_window_name_plugin()
fi
}
if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
fi
source_fzf_config
setup_tmux_window_name_plugin
x-have antidot && eval "$(antidot init)"

View File

@@ -1,3 +0,0 @@
### Do not edit. This was autogenerated by 'asdf direnv setup' ###
export ASDF_DIRENV_BIN="$(asdf where direnv)/bin/direnv"
eval "$($ASDF_DIRENV_BIN hook zsh)"

View File

@@ -291,35 +291,6 @@ hash shopt 2> /dev/null && shopt -s checkwinsize
# shellcheck disable=SC2155
export SHORT_HOST=$(hostname -s)
# asdf
# https://github.com/asdf-vm/asdf
msg "Setting up asdf configuration"
export ASDF_DIR="${HOME}/.local/asdf"
[[ -d $ASDF_DIR ]] && {
# [[ -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"
}
# Antidote configuration
# https://getantidote.github.io/
msg "Setting up Antidote configuration"

View File

@@ -31,39 +31,6 @@ fish_add_path "$YARN_GLOBAL_FOLDER/bin"
test -z "$MASON_HOME" && set -x MASON_HOME "$XDG_DATA_HOME/nvim/mason"
fish_add_path "$MASON_HOME/bin"
# Set ASDF environment variables
test -z "$ASDF_DATA_DIR" && set -x ASDF_DATA_DIR "$XDG_DATA_HOME/asdf"
test -z "$ASDF_LOG_PATH" && set -x ASDF_LOG_PATH "$XDG_STATE_HOME/asdf/log"
test -z "$ASDF_CONFIG_DIR" && set -x ASDF_CONFIG_DIR "$XDG_CONFIG_HOME/asdf"
test -z "$ASDF_CONFIG_FILE" && set -x ASDF_CONFIG_FILE "$ASDF_CONFIG_DIR/asdfrc"
## Default package files
test -z "$ASDF_CRATE_DEFAULT_PACKAGES_FILE" && set -x ASDF_CRATE_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/cargo-packages"
test -z "$ASDF_GEM_DEFAULT_PACKAGES_FILE" && set -x ASDF_GEM_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/gem-packages"
test -z "$ASDF_GOLANG_DEFAULT_PACKAGES_FILE" && set -x ASDF_GOLANG_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/golang-packages"
test -z "$ASDF_NPM_DEFAULT_PACKAGES_FILE" && set -x ASDF_NPM_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/npm-packages"
test -z "$ASDF_PYTHON_DEFAULT_PACKAGES_FILE" && set -x ASDF_PYTHON_DEFAULT_PACKAGES_FILE "$ASDF_CONFIG_DIR/python-packages"
## Plugin configuration
set -x ASDF_DIRENV_IGNORE_MISSING_PLUGINS "1"
set -x ASDF_GOLANG_MOD_VERSION_ENABLED "true"
set -x ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY "latest_available"
test -z "$ASDF_GOLANG_MOD_VERSION_ENABLED" && set -x ASDF_GOLANG_MOD_VERSION_ENABLED "true"
## Load ASDF, if it exists
test -f "$HOME/.local/asdf/asdf.fish" &&
source "$HOME/.local/asdf/asdf.fish" &&
asdf reshim &&
fish_add_path "$ASDF_DIR/shims"
## If $HOME/.local/asdf/asdf.fish does not exist, show error message
test -e "$HOME/.local/asdf/asdf.fish" || echo "ASDF not found"
# Load ASDF completions
test -d "$XDG_CONFIG_HOME/fish/completions" ||
mkdir -p "$XDG_CONFIG_HOME/fish/completions";
test -e "$XDG_CONFIG_HOME/fish/completions/asdf.fish" ||
and ln -s "$ASDF_DIR/completions/asdf.fish" "$XDG_CONFIG_HOME/fish/completions/asdf.fish"
# Set Neovim environment variables
test -z "$NVIM_STATE" && set -x NVIM_STATE "$XDG_STATE_HOME/nvim"
test -z "$NVIM_CONFIG_HOME" && set -x NVIM_CONFIG_HOME "$XDG_CONFIG_HOME/nvim"

View File

@@ -40,9 +40,6 @@
relink: true
path: config/*
exclude: [config/nvm, config/fzf]
~/.local/asdf:
glob: true
path: local/asdf/*
~/.local/bin:
glob: true
path: local/bin/*
@@ -65,46 +62,6 @@
- bash add-submodules.sh || true
- git submodule update --init --recursive --force
- asdf:
- plugin: 1password-cli
url: https://github.com/NeoHsu/asdf-1password-cli.git
- plugin: age
url: https://github.com/threkk/asdf-age.git
- plugin: direnv
url: https://github.com/asdf-community/asdf-direnv.git
- plugin: dotenv-linter
url: https://github.com/wesleimp/asdf-dotenv-linter.git
- plugin: editorconfig-checker
url: https://github.com/gabitchov/asdf-editorconfig-checker.git
- plugin: fd
url: https://gitlab.com/wt0f/asdf-fd.git
- plugin: github-cli
url: https://github.com/bartlomiejdanek/asdf-github-cli.git
- plugin: golang
url: https://github.com/asdf-community/asdf-golang.git
- plugin: hadolint
url: https://github.com/devlincashman/asdf-hadolint.git
- plugin: kubectl
url: https://github.com/asdf-community/asdf-kubectl.git
- plugin: pre-commit
url: https://github.com/jonathanmorley/asdf-pre-commit.git
- plugin: ripgrep
url: https://gitlab.com/wt0f/asdf-ripgrep.git
- plugin: rust
url: https://github.com/code-lever/asdf-rust.git
- plugin: shellcheck
url: https://github.com/luizm/asdf-shellcheck.git
- plugin: shfmt
url: https://github.com/luizm/asdf-shfmt.git
- plugin: terragrunt
url: https://github.com/ohmer/asdf-terragrunt.git
- plugin: tf-summarize
url: https://github.com/adamcrews/asdf-tf-summarize.git
- plugin: yamllint
url: https://github.com/ericcornelissen/asdf-yamllint.git
- plugin: yq
url: https://github.com/sudermanjr/asdf-yq.git
- shell:
- bash local/bin/dfm install all

Submodule local/asdf deleted from 4b9297b82d

View File

@@ -43,7 +43,6 @@ section_install()
MENU=(
"all:Installs everything in the correct order"
"asdf:Install asdf plugins"
"cargo:Install rust/cargo packages"
"cheat-databases:Install cheat external cheatsheet databases"
"composer:Install composer"
@@ -65,7 +64,6 @@ section_install()
$0 install macos
$0 install fonts
$0 brew install
$0 install asdf
$0 install composer
$0 install fzf
$0 install cheat-databases
@@ -77,12 +75,6 @@ section_install()
msgr yay "All done!"
;;
asdf)
msgr run "Installing asdf..."
$0 asdf plugins-install \
&& msgr yay "asdf plugins installed!"
;;
cargo)
msgr run "Installing cargo packages..."
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
@@ -270,164 +262,6 @@ section_brew()
! x-have brew && menu_builder "$USAGE_PREFIX" "brew not available on this system"
}
section_asdf()
{
USAGE_PREFIX="$SCRIPT asdf <command>"
MENU=(
"current:Show asdf current versions"
"global:Show asdf global versions"
"installed:Show asdf installed versions"
"plugins-update:Update all asdf plugins"
"plugins-install:Install plugins from configuration"
"plugins-remove:Remove installed plugins"
"reset:Reset asdf plugins"
"fix-tool-versions:Remove uninstalled plugins from .tool-versions"
"versions:Show asdf versions"
"where:Show asdf where"
"which:Show asdf which"
)
case "$1" in
plugins-update)
msgr run "Updating all asdf plugins"
asdf plugin update --all
msgr run_done "Updated all plugins"
;;
plugins-install)
msgr run "Installing plugins from configuration"
# First install direnv if it's not installed
if ! asdf plugin list | grep -q "^direnv$"; then
msgr nested "Installing direnv plugin"
asdf plugin add direnv https://github.com/asdf-community/asdf-direnv.git
# Install latest direnv
local latest_direnv
latest_direnv=$(asdf latest direnv)
asdf install direnv "$latest_direnv"
asdf global direnv "$latest_direnv"
fi
# Check that all plugins are installed
local installed_plugins
installed_plugins=$(asdf plugin list)
while IFS= read -r line; do
# Skip empty lines and comments
[[ -z $line || $line =~ ^# ]] && continue
local plugin
plugin=$(echo "$line" | awk '{print $1}')
# Skip direnv, it's already installed
[[ $plugin == "direnv" ]] && continue
if ! echo "$installed_plugins" | grep -q "^${plugin}$"; then
msgr nested "Installing $plugin plugin"
asdf plugin add "$plugin"
fi
done < "$DOTFILES/base/tool-versions"
msgr run_done "All plugins installed"
;;
plugins-remove)
msgr run "Remove installed plugins"
local installed_plugins
installed_plugins=$(asdf plugin list | grep -v "^direnv$")
for plugin in $installed_plugins; do
msgr nested "Removing $plugin"
asdf plugin remove "$plugin"
done
msgr run_done "Remove plugins done!"
;;
reset)
msgr run "Resetting asdf environment"
$0 asdf plugins-remove
$0 asdf plugins-install
asdf reshim
msgr yay "Reset asdf plugins done!"
;;
fix-tool-versions)
local tool_versions_file="$DOTFILES/base/tool-versions"
local temp_file
temp_file=$(mktemp)
msgr run "Fixing tool-versions file"
# Check that .tool-versions file exists
if [[ ! -f $tool_versions_file ]]; then
msgr error "tool-versions file not found: $tool_versions_file"
rm -f "$temp_file"
return 1
fi
# Check that asdf can be found in the path
if ! command -v asdf > /dev/null; then
msgr error "asdf not found"
rm -f "$temp_file"
return 1
fi
# Read installed plugins
msgr nested "Reading installed plugins"
local installed_plugins
installed_plugins=$(asdf plugin list | sort)
# Compare .tool-versions and installed plugins,
# remove unknown plugins from .tool-versions
msgr nested "Updating tool-versions file"
while IFS= read -r line; do
# Keep comments and empty lines
if [[ -z $line || $line =~ ^[[:space:]]*# ]]; then
echo "$line" >> "$temp_file"
continue
fi
local plugin
plugin=$(echo "$line" | awk '{print $1}')
if echo "$installed_plugins" | grep -q "^${plugin}$"; then
echo "$line" >> "$temp_file"
else
msgr nested "Removing $plugin - not installed"
fi
done < "$tool_versions_file"
# Check that the temp file is valid
if [[ ! -s $temp_file ]] || ! grep -v '^[[:space:]]*#' "$temp_file" | grep -q .; then
msgr error "Generated file is empty or contains only comments, keeping original"
rm -f "$temp_file"
return 1
fi
# Backup the original .tool-versions
cp "$tool_versions_file" "${tool_versions_file}.bak"
# Overwrite .tool-versions with the generated file
mv "$temp_file" "$tool_versions_file"
msgr run_done "Updated $tool_versions_file"
msgr nested "Backup saved as ${tool_versions_file}.bak"
return 0
;;
current) asdf current ;;
global) asdf global ;;
installed) asdf list ;;
versions) asdf list all ;;
where) asdf where ;;
which) asdf which ;;
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
esac
}
section_helpers()
{
USAGE_PREFIX="$SCRIPT helpers <command>"
@@ -647,7 +481,7 @@ section_dotfiles()
fd --full-path "$DOTFILES" -tx \
--hidden \
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
-E 'test' -E '**/bin/asdf/**' -E '**/tldr/*' \
-E 'test' -E '**/tldr/*' \
-x shfmt \
--language-dialect bash \
--func-next-line --list --write \
@@ -778,8 +612,6 @@ usage()
echo ""
section_apt
echo ""
section_asdf
echo ""
section_brew
echo ""
section_check
@@ -801,7 +633,6 @@ main()
case "$SECTION" in
install) section_install "$@" ;;
apt) section_apt "$@" ;;
asdf) section_asdf "$@" ;;
brew) section_brew "$@" ;;
check) section_check "$@" ;;
dotfiles) section_dotfiles "$@" ;;