#!/usr/bin/env bash # # a development environment setup tool. sudo apt update -qq && sudo apt install -y curl # sudo install -dm 755 /etc/apt/keyrings DEST=${1:-/etc/skel} URI="mise.jdx.dev" TRANSPORT="https:/" TYPES=(deb) SUITES="stable" COMPONENTS=(main) ARCHITECTURES=(amd64) KEY_DIR="/usr/share/keyrings" KEY="${KEY_DIR}/mise-archive-keyring.gpg" MISE_HOME="${DEST}/.config/mise" MISE_CONFIG_DIR="${MISE_HOME}/conf.d" mkdir -p "${MISE_CONFIG_DIR}" curl -fSs ${TRANSPORT}/${URI}/gpg-key.pub | sudo gpg --dearmor --yes -o ${KEY} 1>/dev/null conf_print_sources() { cat <"$temp_config"; then echo "Error: Provider command failed. Keeping existing config." rm -f "$temp_config" return 1 fi # 3. Rotate existing config if it exists if [[ -f "$target_file" ]]; then echo "Backing up $(basename "$target_file") to .backups/..." mv "$target_file" "${backup_dir}/$(basename "$target_file").${timestamp}.bak" fi # 4. Move new config into place mv "$temp_config" "$target_file" echo "New config written to $target_file" # 5. Cleanup find "$backup_dir" -name "*.bak" -type f -mtime +"$retention_days" -delete } # Have mise activated by zsh echo "eval $(/usr/bin/mise activate zsh)" >"${DEST}/.zshrc.d/004_mise.zsh" # mise plugins mise plugins install conda export MISE_CONDA_PYTHON_EXE=/opt/conda/bin/python # then remove zgenom load bckim92/zsh-autoswitch-conda # Link mise to existing containers in .mise.yml for a project CONDA_ENVS_DIR="${DEST}/.conda/envs" # mise use python@prefix: # Example if your environment is named 'my-data-env' # mise use python@prefix:~/anaconda3/envs/my-data-env # mise use python@prefix:${CONDA_ENVS_DIR}/my-data-env # mise use node@prefix:${CONDA_ENVS_DIR}/node_env # mise use go@prefix:${CONDA_ENVS_DIR}/goenv conf_print_mise_config() { cat <