1
0
Files
chezmoi/home/.chezmoiscripts/run_once_after_10-asdf-config.sh.tmpl
2025-08-14 18:01:18 +02:00

47 lines
1.0 KiB
Cheetah

#!{{ lookPath "bash" }}
# title
title="ASDF configuration"
# include lib
. ${CHEZMOI_WORKING_TREE}/scripts/utils.sh
# Plugins to install
declare -A plugins
plugins=(
['direnv']=''
['starship']=''
['golang']='https://github.com/asdf-community/asdf-golang.git'
['nodejs']='https://github.com/asdf-vm/asdf-nodejs.git'
['opam']='https://github.com/asdf-community/asdf-opam.git'
['ruby']='https://github.com/asdf-vm/asdf-ruby.git'
['rust']='https://github.com/code-lever/asdf-rust.git'
)
### Install ASDF plugins ###
log "Begin ${title}"
inf "installing direnv with system version..."
# no need to run asdf direnv setup --shell zsh --version latest
# as it is managed by zim module
for plugin in ${!plugins[@]}; do
if [[ ! $(asdf plugin list | grep "^${plugin}$") ]]; then
inf "installing ${plugin}..."
asdf plugin add ${plugin} ${plugins[$plugin]}
asdf install ${plugin} latest
asdf set ${plugin} latest
asdf reshim ${plugin}
fi
done
inf "initializing opam..."
opam init -n
log "${title} done"