Replaced ASDF with mise

This commit is contained in:
Brian Zalewski 2024-01-03 03:36:15 +00:00
parent cc86aed303
commit 3247597a09
28 changed files with 54 additions and 104 deletions

View file

@ -299,6 +299,7 @@ softwareGroups:
- lsd
- mask
- mc
- mise
- navi
- nb
- neovim

View file

@ -133,12 +133,6 @@
type = "file"
url = "https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
### ASDF
[".local/share/asdf"]
type = "git-repo"
url = "https://github.com/asdf-vm/asdf.git"
{{ $gitArgs }}
### Bash (Sensible defaults)
[".local/share/shell/sensible.bash"]
type = "file"

View file

@ -3,7 +3,6 @@
.DS_Store/
.ansible/
.ansible.log/
.asdf
Brewfile
.bash_logout
.bash_profile

View file

@ -177,37 +177,6 @@ applyWallpaper() {
{{ end -}}
}
# @description
# This script ensures ASDF is setup and then adds the plugins specified in the `~/.tool-versions` file. After that,
# it ensures the ASDF plugins are pre-installed.
asdfPluginInstall() {
### Re-source ~/.bashrc if necessary
if [ -z "$ASDF_DIR" ]; then
logg info 'ASDF_DIR is not defined so ~/.bashrc will be sourced' && source ~/.bashrc
fi
if [ -f "$ASDF_DIR/asdf.sh" ] && [ -f ~/.tool-versions ]; then
logg info 'Sourcing asdf.sh'
. ${ASDF_DIR}/asdf.sh
cat .tool-versions | while read TOOL; do
logg info 'Installing ASDF plugin '"$(echo "$TOOL" | sed 's/ .*//')"'' && asdf plugin add "$(echo "$TOOL" | sed 's/ .*//')" > /dev/null && logg info "Successfully added $(echo "$TOOL" | sed 's/ .*//') via ASDF"
done
# Only proceed with installation if either DEBUG_MODE is enabled or ~/.cache/megabyte-labs/asdf-install is missing
# Added to save time between tests because PHP takes awhile to install
if [ "$DEBUG_MODE" == 'true' ] || [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install" ]; then
logg info 'Installing ASDF dependencies derived from ~/.tool-versions via asdf install'
asdf install || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing the ASDF plugins specified in ~/.tool-versions'
fi
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs"
touch "${XDG_CACHE_HOME:-$HOME/.cache}/megabyte-labs/asdf-install"
fi
else
logg warn 'The $ASDF_DIR/asdf.sh or ~/.tool-versions file is not present'
fi
}
### Helper function for configureNetworkManager
ensureNetworkConfigs() {
if [ ! -d /etc/network/if-up.d ]; then
@ -1027,7 +996,6 @@ if [ -n "$DEBUG" ] || [ -n "$DEBUG_MODE" ]; then
applyLinuxThemeFiles
applyRootConfig
applyWallpaper
asdfPluginInstall
configureNetworkManagerVPNProfiles
configureSSHD
dconfSettings
@ -1055,7 +1023,6 @@ else
applyLinuxThemeFiles &
applyRootConfig &
applyWallpaper &
asdfPluginInstall &
configureNetworkManagerVPNProfiles &
configureSSHD &
dconfSettings &

View file

@ -39,7 +39,6 @@ if command -v install-program > /dev/null; then
logg info 'Printing environment variables for Java'
env | grep JAVA
env | grep SDKMAN
env | grep ASDF
if ! command -v unbuffer > /dev/null; then
if command -v brew > /dev/null; then
logg info 'Ensuring expect is installed for the unbuffer command' && brew install --quiet expect

View file

@ -25,7 +25,7 @@ if [ -d /Applications ] && [ -d /System ]; then
if command -v brew > /dev/null; then
### Install base dependencies
logg 'Installing base dependencies for macOS using brew bundle'
logg info 'Dependencies: age asdf jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx'
logg info 'Dependencies: age jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx'
logg info 'GNU compatibility dependencies: coreutils findutils'
brew bundle --verbose --no-lock --file=/dev/stdin <<EOF

View file

@ -1,4 +1,3 @@
{{/* bison required for ASDF PHP installation */}}
{{- $packages := list
"bash"
"bison"

View file

@ -38,9 +38,6 @@ if [ "$USER" = 'root' ]; then
return
fi
### Java (asdf)
[ ! -f "$ASDF_DATA_DIR/plugins/java/set-java-home.bash" ] || . "$ASDF_DATA_DIR/plugins/java/set-java-home.bash"
### Ble.sh
# Loaded with bash-it
# [[ $- == *i* ]] && source "${XDG_DATA_HOME:-$HOME/.local/share}/blesh/ble.sh" --noattach --rcfile "${XDG_CONFIG_HOME:-$HOME/.config}/blesh/bleshrc"
@ -154,6 +151,9 @@ if [ "$BASH_SUPPORT" = 'true' ] && [ -n "$BASH" ]; then
### Fig
[ ! -f "$HOME/.fig/shell/bashrc.post.bash" ] || . "$HOME/.fig/shell/bashrc.post.bash"
### mise
! command -v mise > /dev/null || eval "$(mise activate bash)"
### Navi (Ctrl+G)
! command -v navi > /dev/null || eval "$(navi widget bash)"

View file

@ -1,9 +0,0 @@
# See the docs for explanations: https://asdf-vm.com/manage/configuration.html
# Use plugin fallback to legacy version files (e.g. `.ruby-version`) if available
legacy_version_file = yes
# Use release candidate rather than latest semantic version
use_release_candidates = yes
{{ if and (eq .chezmoi.os "darwin") (not .host.restricted) -}}
java_macos_integration_enable = yes
{{ end -}}

View file

@ -1 +0,0 @@
# Default Cargo packages installed whenever ASDF Rust version is changed

View file

@ -1 +0,0 @@
# Default Go packages installed whenever ASDF Go version is changed

View file

@ -1,2 +0,0 @@
# Default NPM packages installed whenever ASDF Node version is changed
# Note: Prefer using Volta since it does not have to reinstall the CLIs when switching versions

View file

@ -1,3 +0,0 @@
# Default Python packages installed whenever ASDF Python version is changed
# Note: Prefer using PIPX since it does not have to reinstall the CLIs when switching versions
pytest

View file

@ -1 +0,0 @@
# Default Ruby Gem packages installed whenever ASDF Ruby version is changed

View file

@ -0,0 +1,22 @@
[tools]
java = 'openjdk-20'
node = 'lts'
python = ['3.10', '3.11', '3.12']
ruby = '3.1.3'
[settings]
legacy_version_file = true
always_keep_download = false
always_keep_install = false
plugin_autoupdate_last_check_duration = '1 week'
verbose = false
asdf_compat = false
jobs = 4
raw = false
yes = false
not_found_auto_install = true
task_output = "prefix"
shorthands_file = '~/.config/mise/shorthands.toml'
disable_default_shorthands = false
env_file = '.env'
experimental = true

View file

View file

View file

View file

View file

@ -124,17 +124,6 @@ export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/aqua"
export AQUA_GLOBAL_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/aqua/aqua.yaml"
export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH"
### ASDF
export ASDF_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/asdfrc"
export ASDF_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/asdf"
export ASDF_DATA_DIR="$ASDF_DIR"
export ASDF_CRATE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-cargo-pkgs"
export ASDF_GEM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-ruby-pkgs"
export ASDF_GOLANG_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-golang-pkgs"
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
export ASDF_NPM_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-npm-packages"
export ASDF_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/asdf/default-python-pkgs"
### AWS CLI
export AWS_SHARED_CREDENTIALS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aws/credentials"
export AWS_CONFIG_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aws/config"
@ -262,11 +251,7 @@ fi
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
export GO111MODULE=on
export PATH="$PATH:${GOPATH}/bin"
if command -v go > /dev/null && which go | grep -q 'asdf' > /dev/null && command -v asdf > /dev/null; then
GOROOT="$(asdf where golang)/go"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
elif command -v go > /dev/null && command -v brew > /dev/null; then
if command -v go > /dev/null && command -v brew > /dev/null; then
GOROOT="$(brew --prefix go)/libexec"
export GOROOT
export PATH="$PATH:${GOROOT}/bin"
@ -332,6 +317,12 @@ export MCFLY_KEY_SCHEME=vim
### minikube
export MINIKUBE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/minikube"
### mise
export MISE_GO_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/mise/default-go-pkgs"
export MISE_NODE_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/mise/default-node-pkgs"
export MISE_RUBY_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/mise/default-ruby-pkgs"
export MISE_PYTHON_DEFAULT_PACKAGES_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/mise/default-python-pkgs"
### Monero
if [ -f /Applications/monero-wallet-gui.app/Contents/MacOS/monerod ]; then
export PATH="$PATH:/Applications/monero-wallet-gui.app/Contents/MacOS"

View file

@ -134,8 +134,6 @@ updateall() {
brew upgrade
brew upgrade --cask --greedy
brew cleanup --prune=1
asdf update || true
asdf plugin-update --all
rustup self update || true
rustup update || true
npm update -g || true

View file

@ -46,7 +46,7 @@
command_execution_time # duration of the last command
background_jobs # presence of background jobs
direnv # direnv status (https://direnv.net/)
asdf # asdf version manager (https://github.com/asdf-vm/asdf)
# asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
anaconda # conda environment (https://conda.io/)
# pyenv # python environment (https://github.com/pyenv/pyenv)
@ -571,7 +571,7 @@
###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]###############
# Default asdf color. Only used to display tools for which there is no color override (see below).
# Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_FOREGROUND.
typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66
# typeset -g POWERLEVEL9K_ASDF_FOREGROUND=66
# There are four parameters that can be used to hide asdf tools. Each parameter describes
# conditions under which a tool gets hidden. Parameters can hide tools but not unhide them. If at

View file

@ -137,9 +137,6 @@ if [ -d /Applications ] && [ -d /System ]; then
fi
fi
### ASDF
[ ! -f "$ASDF_DIR/asdf.sh" ] || . "$ASDF_DIR/asdf.sh"
### Tea
# TODO: Fix this so it does not cause errors as Chezmoi runs
# if command -v tea > /dev/null; then

View file

@ -1,3 +0,0 @@
{{- if (lookPath "asdf") -}}
{{- output "echo" "${XDG_DATA_HOME:-$HOME/.local/share}/asdf/completions/asdf.bash" -}}
{{- end -}}

View file

@ -1,3 +0,0 @@
{{- if (lookPath "asdf") -}}
{{ .host.home }}/.local/share/asdf/completions/_asdf
{{- end -}}

View file

@ -1,9 +0,0 @@
golang system
java openjdk-17
deno system
nodejs system
php system
poetry system
python system
ruby 3.1.3
rust system

View file

@ -15,9 +15,6 @@ if [ "$USER" = 'root' ]; then
return
fi
### Java (asdf)
[ ! -f "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh" ] || source "$ASDF_DATA_DIR/plugins/java/set-java-home.zsh"
# If not running interactively, don't do anything
case $- in
*i*) ;;
@ -447,6 +444,9 @@ fi
### iTerm2
[ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.zsh" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/iterm/iterm2.zsh"
### mise
! command -v mise > /dev/null || eval "$(mise activate zsh)"
### Navi (Ctrl+G)
! command -v navi > /dev/null || eval "$(navi widget zsh)"

View file

@ -2633,6 +2633,21 @@ softwarePackages:
valet install
valet trust
cask: nicoverbruggen/homebrew-cask/phpmon
mise:
_bin: mise
_github:
_name: mise
_post: |
#!/usr/bin/env bash
mise use --global openjdk-20
sudo mkdir -p /Library/Java/JavaVirtualMachines/openjdk-20.jdk
sudo ln -s "${XDG_DATA_HOME:-$HOME/.local/share}/mise/installs/java/openjdk-20/Contents" /Library/Java/JavaVirtualMachines/openjdk-20.jdk/Contents
apk: mise
brew: mise
cargo: mise-cli
nix-env: mise
npm: '@jdxcode/mise'
port: port
composer:
_bin: composer
_desc: '[Composer](https://getcomposer.org/) is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project.'