diff --git a/.gitignore b/.gitignore index 0407a58..f161822 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,6 @@ Thumbs.db !.ssh/config .aws/* !.aws/config -.asdf -.asdf/* .composer/* .dlv/* !.dlv/config.yml diff --git a/MacOS/base b/MacOS/base index c7d4107..3c69412 100644 --- a/MacOS/base +++ b/MacOS/base @@ -14,7 +14,6 @@ function are_basics_installed() { # `awscli` https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html declare -a BREW_BASICS=( 'actionlint' - 'asdf' 'awscli' 'bash' 'coreutils' @@ -32,6 +31,7 @@ function are_basics_installed() { 'bitwarden-cli' 'mackup' 'mas' + 'mise' 'oh-my-posh' 'parallel' 'pssh' @@ -49,26 +49,12 @@ function are_basics_installed() { install_if_not_installed 'brew' "${ASK}" "${BREW_BASICS[@]}" } -function is_asdf_installed() { +function is_mise_installed() { local ASK="${1:-'y'}" - if ! command -v asdf &> /dev/null || ! command -v brew &> /dev/null; then - declare -a ASDF_DEPS=('autoconf' - 'automake' - 'coreutils' - 'gcc' - 'libtool' - 'libxslt' - 'libyaml' - 'openssl' - 'make' - 'readline' - 'unixodbc' - 'unzip') + if ! command -v mise &> /dev/null || ! command -v brew &> /dev/null; then msg_info 'Will try to install brew if not installed' are_basics_installed "${ASK}" - msg_info 'Will try to install asdf dependencies' - install_if_not_installed 'brew' "${ASK}" "${ASDF_DEPS[@]}" - msg_info 'Will try to install asdf using git' - source_asdf + msg_info 'Will try to activate mise' + source_mise fi } diff --git a/MacOS/bash_profile b/MacOS/bash_profile index 3d105ad..4f97358 100644 --- a/MacOS/bash_profile +++ b/MacOS/bash_profile @@ -10,24 +10,6 @@ if [ -f "$(brew --prefix)"/etc/bash_completion ]; then source "$(brew --prefix)"/etc/bash_completion fi -# `asdf` is now managed by homebrew -export ASDF_DATA_DIR="${HOME}/.asdf" -# shellcheck disable=SC1090 -. <(asdf completion bash) -# Hook direnv into your shell. -# shellcheck disable=SC1091 -. "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/bashrc" - -# Go specific env vars -GOPATH="${HOME}/src/gopath" -GOROOT="$(asdf where golang)/go" -export GOPATH GOROOT - -# Java specific env vars -JDK_HOME="$(asdf where java)" -JAVA_HOME="$(asdf where java)/jre" -export JDK_HOME JAVA_HOME - # Update PATH export PATH="$(brew --prefix)/opt/curl/bin:${PATH}:${HOME}/src/gopath/bin:${HOME}/bin" diff --git a/README.md b/README.md index 669eb5c..3adee7a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Keep key configurations and share them among your computers - Installs: - [1password-cli](https://support.1password.com/command-line/) - - [asdf](https://github.com/asdf-vm/asdf) + - [mise](https://github.com/jdx/mise) - [awscli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) - [oh-my-posh](https://ohmyposh.dev) - [bfg](https://rtyley.github.io/bfg-repo-cleaner/) diff --git a/Ubuntu/base b/Ubuntu/base index fb3b4dd..ec25370 100644 --- a/Ubuntu/base +++ b/Ubuntu/base @@ -43,7 +43,6 @@ function are_basics_installed() { BREW_BASICS=( 'actionlint' 'asciidoc' - 'asdf' 'awscli' 'fontconfig' 'gcc' @@ -53,6 +52,7 @@ function are_basics_installed() { 'jless' 'jq' 'mackup' + 'mise' 'oh-my-posh' 'parallel' 'pssh' @@ -71,29 +71,12 @@ function are_basics_installed() { install_if_not_installed 'brew' "${ASK}" "${BREW_BASICS[@]}" } -function is_asdf_installed() { +function is_mise_installed() { local ASK="${1:-'y'}" - if [[ ! -e "${HOME}/.asdf/asdf.sh" ]] || [[ ! -e "$(get_brew_location)" ]]; then - # Ubuntu 18.04 `apt install -y libncurses-dev libxslt-dev` gives the output below - # Note, selecting 'libncurses5-dev' instead of 'libncurses-dev' - # Note, selecting 'libxslt1-dev' instead of 'libxslt-dev' - declare -a ASDF_DEPS=('autoconf' - 'automake' - 'libbz2-dev' - 'libffi-dev' - 'libncurses5-dev' - 'libreadline-dev' - 'libsqlite3-dev' - 'libssl-dev' - 'libtool' - 'libxslt1-dev' - 'libyaml-dev' - 'unixodbc-dev' - 'unzip') + if ! command -v mise &> /dev/null || [[ ! -e "$(get_brew_location)" ]]; then + msg_info 'Will try to install brew if not installed' are_basics_installed "${ASK}" - msg_info 'Will try to install asdf dependencies' - install_if_not_installed 'apt' "${ASK}" "${ASDF_DEPS[@]}" - msg_info 'Will try to install asdf using git' - source_asdf + msg_info 'Will try to activate mise' + source_mise fi } diff --git a/Ubuntu/bash_profile b/Ubuntu/bash_profile index 145fcf5..23920f8 100644 --- a/Ubuntu/bash_profile +++ b/Ubuntu/bash_profile @@ -1,23 +1,5 @@ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -# `asdf` is now managed by homebrew -export ASDF_DATA_DIR="${HOME}/.asdf" -# shellcheck disable=SC1090 -. <(asdf completion bash) -# Hook direnv into your shell. -# shellcheck disable=SC1091 -. "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/bashrc" - -# Go specific env vars -GOPATH="${HOME}/src/gopath" -GOROOT="$(asdf where golang)/go" -export GOPATH GOROOT - -# Java specific env vars -JDK_HOME="$(asdf where java)" -JAVA_HOME="$(asdf where java)/jre" -export JDK_HOME JAVA_HOME - # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize diff --git a/asdfrc b/asdfrc deleted file mode 100644 index 7940947..0000000 --- a/asdfrc +++ /dev/null @@ -1,6 +0,0 @@ -legacy_version_file = no -use_release_candidates = no -always_keep_download = no -plugin_repository_last_check_duration = 60 -disable_plugin_short_name_repository = no -concurrency = auto diff --git a/bash_aliases b/bash_aliases index ae282f6..3a3ef32 100644 --- a/bash_aliases +++ b/bash_aliases @@ -109,13 +109,9 @@ function clean-multipass() { multipass purge } -function asdf-all () { - awk '{ print $1 }' ~/.tool-versions | grep -v '^#' -} - -function asdf-all-versions () { - for i in $(asdf plugin list); do - echo "Plugin ${i} and versions are $(asdf list "${i}")" +function mise-all-versions () { + for i in $(mise plugin ls); do + echo "Plugin ${i} and versions are $(mise ls -i "${i}")" done } @@ -282,7 +278,7 @@ function pkg_update() { "system" "mas" "brew" - "asdf" + "mise" "nodejs" "gem" "pip3" @@ -299,7 +295,7 @@ function pkg_update() { msg_info "Packages to update: ${pkgs[*]}" for pkg in "${pkgs[@]}"; do case "${pkg}" in - system|mas|brew|asdf|nodejs|gem|pip3|mackup) + system|mas|brew|mise|nodejs|gem|pip3|mackup) pkg_update_"${pkg}" ;; *) @@ -359,14 +355,9 @@ function pkg_update_brew() { brew update; brew upgrade; brew cleanup; } -function pkg_update_asdf() { - msg_info 'cd ~/.asdf/plugins/python/pyenv/ && git pull && cd -' - cd ~/.asdf/plugins/python/pyenv/ || return 1 - git pull - cd - || return 1 - - msg_info 'asdf plugin update --all' - asdf plugin update --all +function pkg_update_mise() { + msg_info 'mise plugins ls | xargs -L1 mise plugins update' + mise plugins ls | xargs -L1 mise plugins update } function pkg_update_nodejs() { diff --git a/bash_profile b/bash_profile index beb5d27..f4f4649 100644 --- a/bash_profile +++ b/bash_profile @@ -67,3 +67,7 @@ eval "$(oh-my-posh init bash --config "${HOME}"/.ohmyposh.json)" if [ -f "${HOME}/.config/fabric/fabric-bootstrap.inc" ]; then . "${HOME}/.config/fabric/fabric-bootstrap.inc" fi + +# activate mise +# https://mise.jdx.dev/ +eval "$(mise activate bash)" diff --git a/envrc b/envrc deleted file mode 100644 index a63eb96..0000000 --- a/envrc +++ /dev/null @@ -1 +0,0 @@ -use asdf diff --git a/lib/utils b/lib/utils index 22c6f5f..fb9539d 100644 --- a/lib/utils +++ b/lib/utils @@ -85,11 +85,9 @@ function get_latest_github_tag() { echo -n "${latest_tag}" } -function source_asdf() { +function source_mise() { disableStrictMode - export ASDF_DATA_DIR="${HOME}/.asdf" - # shellcheck disable=SC1090 - . <(asdf completion bash) + eval "$(mise activate bash)" strictMode } @@ -179,9 +177,8 @@ function get_user_reply() { # Install everything else function install_everything_else() { - # Install asdf plugins and tools' versions - install_asdf_tool_versions - configure_direnv + # Install mise plugins and tools' versions + install_mise_tool_versions hash -r msg_info "Sourcing ${HOME}/.bashrc" @@ -363,108 +360,13 @@ function get_git_tags() { | LC_ALL=C sort -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4d -k 5,5d } -function install_asdf_tool_versions() { - # How to: - # only to be used after asdf has been installed and asdf's: - # `${HOME}/.asdf/shims:${HOME}/.asdf/bin` - # are in ${PATH} - local TOOLS_VERSIONS="${HOME}/.tool-versions" VERSION - declare -a PLUGINS=() - msg_info 'Installing asdf plugins' - mapfile -t PLUGINS < <(awk '{ print $1 }' "${TOOLS_VERSIONS}" | grep -v '#') - for PLUGIN in "${PLUGINS[@]}"; do - install_asdf_tool "${PLUGIN}" - VERSION="$(grep "${PLUGIN} " "${TOOLS_VERSIONS}" | awk '{ print $2 }')" - install_asdf_tool_version "${PLUGIN}" "${VERSION}" - done -} - -function install_asdf_tool() { - local PLUGIN="${1}" - local PLUGIN_REPO="${2:- }" - local COMMAND="asdf plugin add ${PLUGIN} ${PLUGIN_REPO}" - if eval "${COMMAND}" &> /dev/null; then - msg_info "asdf plugin ${PLUGIN} was installed" - else - msg_warn "asdf plugin ${PLUGIN} was not installed" - fi -} - -function install_asdf_tool_version() { - local PLUGIN="${1}" - local VERSION="${2}" - local CATCH_OUTPUT - CATCH_OUTPUT=$(mktemp install_asdf_tool_versions.XXXXXXX) - if asdf install "${PLUGIN}" "${VERSION}" &> "${CATCH_OUTPUT}"; then - msg_info "Installed ${PLUGIN} version ${VERSION} from ${TOOLS_VERSIONS}" - rm -f "${CATCH_OUTPUT}" - else - msg_error "I was not able to ${PLUGIN} version ${VERSION} from ${TOOLS_VERSIONS}, error is below:" - msg_error "$(cat "${CATCH_OUTPUT}")" - rm -f "${CATCH_OUTPUT}" - msg_error 'Will move on' - fi -} - -function write_direnvrc() { - msg_info 'Creating file ~/.config/direnv/direnvrc' - cat <<'EOF' > "${HOME}"/.config/direnv/direnvrc -# Uncomment the following line to make direnv silent by default. -#export DIRENV_LOG_FORMAT="" -EOF -} - -function write_use_asdf_sh() { - msg_info 'Creating file ~/.config/direnv/lib/use_asdf.sh' - mkdir -p "${HOME}"/.config/direnv/lib - # if you need to debug why a plugin is not installing correctly change the below to - # use_asdf() { - # set -x - # source_env "$(asdf cmd direnv envrc.bash "$@")" 2>&1 | tee -a /path/to/use_asdf.log - # set +x - # } - cat <<'EOF' > "${HOME}"/.config/direnv/lib/use_asdf.sh -### Do not edit. This was autogenerated by 'asdf cmd direnv setup.bash' ### -use_asdf() { - source_env "$(asdf cmd direnv envrc.bash "$@")" -} -EOF -} - -function write_use_asdf_direnv_bashrc() { - msg_info 'Creating file ~/.config/asdf-direnv/bashrc' - cat < "${HOME}"/.config/asdf-direnv/bashrc -### Do not edit. This was autogenerated by 'asdf cmd direnv setup.bash' ### -VER="\$(asdf current --no-header direnv | awk '{ print \$2 }')" -export ASDF_DIRENV_BIN="\${HOME}/.asdf/installs/direnv/\${VER}/bin/direnv" -eval "\$("\${ASDF_DIRENV_BIN}" hook bash)" -EOF -} - -function configure_direnv() { - local CONFIG_FOLDER="${HOME}/.config" - local DIRENV_CONFIG_FOLDER="${CONFIG_FOLDER}/direnv" - msg_info 'Making ~/.asdf/plugins/direnv/lib/commands/command-*.bash executable' - msg_info 'Temp fix due to https://github.com/asdf-community/asdf-direnv/issues/194#issuecomment-2634107541' - chmod +x ~/.asdf/plugins/direnv/lib/commands/command-*.bash - if [[ ! -e "${DIRENV_CONFIG_FOLDER}" ]]; then - msg_info "${DIRENV_CONFIG_FOLDER} does not exist, I will create it" - mkdir -p "${DIRENV_CONFIG_FOLDER}" - fi - if [[ ! -e "${DIRENV_CONFIG_FOLDER}/direnvrc" ]]; then - msg_info "${DIRENV_CONFIG_FOLDER}/direnvrc does not exist, I'll create it now" - write_direnvrc - fi - if [[ ! -e "${DIRENV_CONFIG_FOLDER}/lib/use_asdf.sh" ]]; then - msg_info "${DIRENV_CONFIG_FOLDER}/lib/use_asdf.sh does not exist, I'll create it now" - write_use_asdf_sh - fi - if [[ ! -e "${CONFIG_FOLDER}/asdf-direnv" ]]; then - msg_info "${CONFIG_FOLDER}/asdf-direnv does not exist, I'll create it now" - mkdir -p "${CONFIG_FOLDER}/asdf-direnv" - fi - if [[ ! -e "${CONFIG_FOLDER}/asdf-direnv/bashrc" ]]; then - msg_info "${CONFIG_FOLDER}/asdf-direnv/bashrc does not exist, I'll create it now" - write_use_asdf_direnv_bashrc - fi +function install_mise_tool_versions() { + # cd to home folder + cd || exit 1 + mise install + # come back to folder we were before we went to home folder + cd - || exit 1 + # trust `mise/config.toml` so tools and their versions are available in this + # repo too + mise trust } diff --git a/mackup.cfg b/mackup.cfg index b1a8c8f..3b6acbb 100644 --- a/mackup.cfg +++ b/mackup.cfg @@ -57,7 +57,6 @@ arara aria2c arm asciinema -asdf aspell astyle atlantis diff --git a/mise/config.toml b/mise/config.toml new file mode 100644 index 0000000..f76f4ed --- /dev/null +++ b/mise/config.toml @@ -0,0 +1,22 @@ +[tools] +go = "1.22.0" +groovy = "2.4.12" +java = "temurin-21.0.6+7.0.LTS" +kotlin = "1.9.22" +lua = "5.4.6" +maven = "3.6.3" +node = "22.13.0" +opam = "2.1.2" +python = "3.13.0" +ruby = "3.3.6" +rust = "1.76.0" +gradle = "6.8.1" +terraform = "1.3.9" +pulumi = "3.80.0" +kubectl = "1.29.0" +kompose = "1.22.0" +helm = "3.13.3" +kustomize = "5.0.3" +helm-docs = "1.10.0" +helm-ct = "3.12.0" +1password-cli = "2.24.0" diff --git a/my-files.cfg b/my-files.cfg index 493cc55..4e360b2 100644 --- a/my-files.cfg +++ b/my-files.cfg @@ -6,4 +6,3 @@ name = My personal synced files and dirs .bash_my_aliases .bash_work_aliases .bash_work_profile -.config/direnv/direnvrc diff --git a/setup.sh b/setup.sh index 03b14b4..9077678 100755 --- a/setup.sh +++ b/setup.sh @@ -56,7 +56,7 @@ done # Installing basics # shellcheck disable=SC1090,SC1091 . "${GITROOT}/${MACHINE_OS}/base" -is_asdf_installed "${ASK}" +is_mise_installed "${ASK}" # Setting up mackup MACKUP_CUSTOM_APPS_DIR="${HOME}/.mackup" @@ -67,7 +67,6 @@ link_if_not_exists "${GITROOT}/${MY_MACKUP_CFG}" "${MACKUP_CUSTOM_APPS_DIR}/${MY # Actual dot-files declare -a LINKS=( - 'asdfrc' 'bashrc' 'bash_profile' 'bash_aliases' @@ -90,6 +89,7 @@ done # Config folders declare -a CONFIG_FOLDERS=( 'ghostty' + 'mise' 'nvim' ) if [[ ! -e "${HOME}/.config" ]]; then diff --git a/tests/test_utils b/tests/test_utils index f92daad..f0f412d 100644 --- a/tests/test_utils +++ b/tests/test_utils @@ -45,7 +45,7 @@ test_arrays function test_latest_tag() { local repo1="https://github.com/JetBrains/kotlin" - local repo2="https://github.com/asdf-vm/asdf.git" + local repo2="https://github.com/jdx/mise" echo "Getting tags for ${repo1}" declare -a tags_from_repo1 tags_from_repo2 mapfile -t tags_from_repo1 < <(get_git_tags "${repo1}") diff --git a/tool-versions b/tool-versions deleted file mode 100644 index ad22222..0000000 --- a/tool-versions +++ /dev/null @@ -1,30 +0,0 @@ -# Programming languages -dotnet-core 8.0.100 -java temurin-21.0.6+7.0.LTS -golang 1.22.0 -groovy 2.4.12 -lua 5.4.6 -nodejs 22.13.0 -opam 2.1.2 -python 3.13.0 -ruby 3.3.6 -rust 1.76.0 -kotlin 1.9.22 -gradle 6.8.1 -maven 3.6.3 -sbt 1.3.6 -# Infrastructure as code tools -pulumi 3.80.0 -terraform 1.3.9 -tflint 0.45.0 -# K8s related tools -kompose 1.22.0 -kubectl 1.29.0 -kustomize 5.0.3 -helm 3.13.3 -helm-ct 3.3.1 -helm-docs 1.10.0 -# misc tools -rclone 1.69.0 -direnv 2.33.0 -1password-cli 2.24.0