mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-18 16:06:00 +00:00
Compare commits
3 Commits
44f83aeb56
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9875a4d4a0 | ||
|
|
035405b22f | ||
|
|
7dd6ccbc6c |
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -36,4 +36,4 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run PR Lint
|
||||
uses: ivuorinen/actions/pr-lint@7f6a23b59316795c4b3cb3b3b28dd53e53655a33 # v2026.03.11
|
||||
uses: ivuorinen/actions/pr-lint@1da3a0e79fcd7da6bed9ee1979f1449ba11f58f9 # v2026.03.14
|
||||
|
||||
2
.github/workflows/new-release.yml
vendored
2
.github/workflows/new-release.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
|
||||
- name: Create release
|
||||
if: steps.daily-version.outputs.created
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_name: ${{ steps.daily-version.outputs.version }}
|
||||
|
||||
2
.github/workflows/sync-labels.yml
vendored
2
.github/workflows/sync-labels.yml
vendored
@@ -30,4 +30,4 @@ jobs:
|
||||
issues: write
|
||||
|
||||
steps:
|
||||
- uses: ivuorinen/actions/sync-labels@7f6a23b59316795c4b3cb3b3b28dd53e53655a33 # v2026.03.11
|
||||
- uses: ivuorinen/actions/sync-labels@1da3a0e79fcd7da6bed9ee1979f1449ba11f58f9 # v2026.03.14
|
||||
|
||||
97
config/exports
Executable file → Normal file
97
config/exports
Executable file → Normal file
@@ -14,7 +14,20 @@
|
||||
# if DOTFILES is not set, set it to the default location
|
||||
[ -z "${DOTFILES:-}" ] && export DOTFILES="$HOME/.dotfiles"
|
||||
|
||||
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
# Editor settings
|
||||
[ -z "${EDITOR:-}" ] && export EDITOR="nvim"
|
||||
[ -z "${VISUAL:-}" ] && export VISUAL="code"
|
||||
|
||||
# Bootstrap: ensure local/bin is on PATH so x-path is available
|
||||
PATH="$DOTFILES/local/bin:$PATH"
|
||||
# Use x-path to deduplicate PATH entries (only if x-path is available)
|
||||
if command -v x-path &> /dev/null; then
|
||||
# shellcheck source=../local/bin/x-path
|
||||
source "$(command -v x-path)"
|
||||
normalize_path_var
|
||||
do_prepend "$XDG_BIN_HOME" "$DOTFILES/local/bin" "/opt/homebrew/bin" "/usr/local/bin"
|
||||
fi
|
||||
export PATH
|
||||
|
||||
if ! command -v msg &> /dev/null; then
|
||||
# Function to print messages if VERBOSE is enabled
|
||||
@@ -304,7 +317,7 @@ export ANTIDOTE_PLUGINS="$XDG_CONFIG_HOME/zsh/antidote_plugins"
|
||||
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
|
||||
msg "Setting up Ansible configuration"
|
||||
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible"
|
||||
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible.cfg"
|
||||
export ANSIBLE_CONFIG="$ANSIBLE_HOME/ansible.cfg"
|
||||
export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
|
||||
x-dc "$ANSIBLE_HOME"
|
||||
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
|
||||
@@ -325,10 +338,26 @@ export AWS_CONFIGURE_OUTPUT=true
|
||||
export AWS_CONFIGURE_PROFILE=true
|
||||
export AWS_CONFIGURE_PROMPT=true
|
||||
export AWS_CONFIGURE_PROMPT_DEFAULT="default"
|
||||
export AWS_SESSION_TOKEN_FILE="${XDG_STATE_HOME}/aws/session_token"
|
||||
export AWS_CONFIGURE_SESSION=true
|
||||
export AWS_CONFIGURE_SESSION_DURATION=7200
|
||||
export AWS_CONFIGURE_SESSION_MFA=true
|
||||
|
||||
# bob manages nvim versions
|
||||
msg "Setting up bob configuration"
|
||||
x-path-prepend "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
# Mason (nvim package manager)
|
||||
msg "Setting up Mason configuration"
|
||||
export MASON_HOME="$XDG_DATA_HOME/nvim/mason"
|
||||
|
||||
# Neovim environment variables — optional overrides for external tools.
|
||||
# Neovim itself uses vim.fn.stdpath() and does not read these.
|
||||
msg "Setting up Neovim configuration"
|
||||
[ -z "${NVIM_STATE:-}" ] && export NVIM_STATE="$XDG_STATE_HOME/nvim"
|
||||
[ -z "${NVIM_CONFIG_HOME:-}" ] && export NVIM_CONFIG_HOME="$XDG_CONFIG_HOME/nvim"
|
||||
[ -z "${NVIM_DATA_HOME:-}" ] && export NVIM_DATA_HOME="$XDG_DATA_HOME/nvim"
|
||||
[ -z "${NVIM_CACHE_HOME:-}" ] && export NVIM_CACHE_HOME="$XDG_CACHE_HOME/nvim"
|
||||
[ -z "${NVIM_LOG_PATH:-}" ] && export NVIM_LOG_PATH="$NVIM_STATE/log"
|
||||
[ -z "${NVIM_SESSION_PATH:-}" ] && export NVIM_SESSION_PATH="$NVIM_STATE/session"
|
||||
[ -z "${NVIM_SHADA_PATH:-}" ] && export NVIM_SHADA_PATH="$NVIM_STATE/shada"
|
||||
[ -z "${NVIM_UNDO_PATH:-}" ] && export NVIM_UNDO_PATH="$NVIM_STATE/undo"
|
||||
|
||||
# bkt (shell command caching tool) configuration
|
||||
msg "Setting up bkt configuration"
|
||||
@@ -350,12 +379,21 @@ export COMPOSER_HOME="$XDG_STATE_HOME/composer"
|
||||
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
|
||||
export PATH="$COMPOSER_BIN:$PATH"
|
||||
|
||||
# Yarn
|
||||
msg "Setting up Yarn configuration"
|
||||
export YARN_GLOBAL_FOLDER="$XDG_DATA_HOME/yarn"
|
||||
|
||||
# docker, https://docs.docker.com/engine/reference/commandline/cli/
|
||||
msg "Setting up Docker configuration"
|
||||
export DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"
|
||||
x-dc "$DOCKER_CONFIG"
|
||||
# Docker: Disable snyk ad
|
||||
export DOCKER_SCAN_SUGGEST=false
|
||||
export DOCKER_HIDE_LEGACY_COMMANDS=true
|
||||
|
||||
# direnv
|
||||
msg "Setting up direnv configuration"
|
||||
export DIRENV_LOG_FORMAT=""
|
||||
|
||||
# fzf
|
||||
export FZF_BASE="${XDG_CONFIG_HOME}/fzf"
|
||||
@@ -375,13 +413,6 @@ export GOBIN="$XDG_BIN_HOME"
|
||||
# Lando
|
||||
export PATH="$HOME/.lando/bin${PATH+:$PATH}" #landopath
|
||||
|
||||
# NPM: Add npm packages to path
|
||||
msg "Setting up NPM configuration"
|
||||
x-have node && {
|
||||
NVM_NODE_BIN_DIR="$(dirname "$(which node)")"
|
||||
export PATH="$NVM_NODE_BIN_DIR:$PATH"
|
||||
}
|
||||
|
||||
# oh-my-posh (omp) configuration
|
||||
msg "Setting up oh-my-posh configuration"
|
||||
export OHMYPOSH_CFG="$DOTFILES/config/omp/own.toml"
|
||||
@@ -391,20 +422,21 @@ msg "Setting up 1Password CLI configuration"
|
||||
export OP_CACHE="$XDG_STATE_HOME/1password"
|
||||
|
||||
# Python
|
||||
#
|
||||
# pyenv, python environments
|
||||
msg "Setting up Python configuration"
|
||||
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
|
||||
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
|
||||
## for MichaelAquilina/zsh-autoswitch-virtualenv
|
||||
export AUTOSWITCH_VIRTUAL_ENV_DIR="$WORKON_HOME"
|
||||
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH"
|
||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
x-have pyenv && eval "$(pyenv init -)"
|
||||
|
||||
# Rust / cargo
|
||||
msg "Setting up Rust/Cargo configuration"
|
||||
export RUST_WITHOUT=rust-docs
|
||||
export CARGO_HOME="$XDG_DATA_HOME/cargo"
|
||||
export CARGO_BIN_HOME="$XDG_BIN_HOME"
|
||||
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
|
||||
export RUST_WITHOUT="clippy,docs,rls"
|
||||
|
||||
# Poetry
|
||||
msg "Setting up Poetry configuration"
|
||||
export POETRY_HOME="$XDG_DATA_HOME/poetry"
|
||||
|
||||
# sonarlint
|
||||
# https://www.sonarlint.org/
|
||||
@@ -433,6 +465,10 @@ export ZSH_TMUX_UNICODE=true
|
||||
export ZSH_TMUX_AUTOQUIT=false
|
||||
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
|
||||
|
||||
# tms (tmux session manager)
|
||||
msg "Setting up tms configuration"
|
||||
export TMS_CONFIG_FILE="$XDG_CONFIG_HOME/tms/config.toml"
|
||||
|
||||
# wakatime, https://github.com/wakatime/wakatime-cli
|
||||
msg "Setting up Wakatime configuration"
|
||||
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
|
||||
@@ -442,12 +478,35 @@ x-dc "$WAKATIME_HOME"
|
||||
msg "Setting up LM Studio configuration"
|
||||
export PATH="$PATH:$HOME/.lmstudio/bin"
|
||||
|
||||
# Screen
|
||||
msg "Setting up screen configuration"
|
||||
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||
|
||||
# Zoxide
|
||||
msg "Setting up Zoxide configuration"
|
||||
export _ZO_DATA_DIR="$XDG_DATA_HOME/zoxide"
|
||||
export _ZO_EXCLUDE_DIRS="$XDG_DATA_HOME"
|
||||
|
||||
# Misc
|
||||
msg "Setting up miscellaneous configuration"
|
||||
export ZSHZ_DATA="$XDG_STATE_HOME/z"
|
||||
export CHEAT_USE_FZF=true
|
||||
export SQLITE_HISTORY="${XDG_CACHE_HOME}/sqlite_history"
|
||||
|
||||
# Additional PATH entries (aligned with fish config)
|
||||
[ -d "$XDG_DATA_HOME/mise/shims" ] && export PATH="$XDG_DATA_HOME/mise/shims:$PATH"
|
||||
[ -d "$YARN_GLOBAL_FOLDER/bin" ] && export PATH="$PATH:$YARN_GLOBAL_FOLDER/bin"
|
||||
[ -d "$MASON_HOME/bin" ] && export PATH="$PATH:$MASON_HOME/bin"
|
||||
[ -d "$HOME/.dotnet/tools" ] && export PATH="$PATH:$HOME/.dotnet/tools"
|
||||
[ -d "$POETRY_HOME/bin" ] && export PATH="$PATH:$POETRY_HOME/bin"
|
||||
[ -d "$HOME/.opencode/bin" ] && export PATH="$PATH:$HOME/.opencode/bin"
|
||||
|
||||
# mise — unified tool version manager
|
||||
# https://mise.jdx.dev
|
||||
if command -v mise &> /dev/null; then
|
||||
eval "$(mise activate "$(basename "${SHELL:-bash}")")"
|
||||
fi
|
||||
|
||||
if [ -f "$XDG_CONFIG_HOME/exports-secret" ]; then source "$XDG_CONFIG_HOME/exports-secret"; fi
|
||||
if [ -f "$XDG_CONFIG_HOME/exports-local" ]; then source "$XDG_CONFIG_HOME/exports-local"; fi
|
||||
# shellcheck source=./exports-lakka
|
||||
|
||||
101
local/bin/dfm
Executable file → Normal file
101
local/bin/dfm
Executable file → Normal file
@@ -73,21 +73,18 @@ section_install()
|
||||
MENU=(
|
||||
"all:Installs everything in the correct order"
|
||||
"apt-packages:Install apt packages (Debian/Ubuntu)"
|
||||
"cargo:Install rust/cargo packages"
|
||||
"cheat-databases:Install cheat external cheatsheet databases"
|
||||
"composer:Install composer"
|
||||
"dnf-packages:Install dnf packages (Fedora/RHEL)"
|
||||
"fonts:Install programming fonts"
|
||||
"gh:Install GitHub CLI Extensions"
|
||||
"git-crypt:Install git-crypt from source"
|
||||
"go:Install Go Packages"
|
||||
"imagick:Install ImageMagick CLI"
|
||||
"macos:Setup nice macOS defaults"
|
||||
"npm-packages:Install NPM Packages"
|
||||
"mise:Install tools via mise (runtimes + CLI tools)"
|
||||
"mise-cleanup:Remove old version manager installations (--dry-run supported)"
|
||||
"ntfy:Install ntfy notification tool"
|
||||
"nvm-latest:Install latest lts node using nvm"
|
||||
"nvm:Install Node Version Manager (nvm)"
|
||||
"python-packages:Install Python packages via uv"
|
||||
"python-libs:Install Python libraries (libtmux, pynvim)"
|
||||
"shellspec:Install shellspec testing framework"
|
||||
"xcode-cli-tools:Install Xcode CLI tools (macOS)"
|
||||
"z:Install z"
|
||||
@@ -107,13 +104,10 @@ section_install()
|
||||
$0 brew install
|
||||
$0 install fonts
|
||||
|
||||
# Tier 2: Language packages (depend on runtimes from Tier 1)
|
||||
$0 install cargo
|
||||
$0 install go
|
||||
$0 install composer
|
||||
$0 install nvm
|
||||
$0 install npm-packages
|
||||
$0 install python-packages
|
||||
# Tier 2: Runtimes and CLI tools via mise, then remaining installers
|
||||
$0 install mise || exit 1
|
||||
$0 install composer || exit 1
|
||||
$0 install python-libs || exit 1
|
||||
|
||||
# Tier 3: Tool-dependent installers
|
||||
$0 install cheat-databases
|
||||
@@ -131,12 +125,6 @@ section_install()
|
||||
msgr yay "All done!"
|
||||
;;
|
||||
|
||||
cargo)
|
||||
msgr run "Installing cargo packages..."
|
||||
bash "$DOTFILES/scripts/install-cargo-packages.sh" \
|
||||
&& msgr yay "cargo packages installed!"
|
||||
;;
|
||||
|
||||
cheat-databases)
|
||||
msgr run "Installing cheat databases..."
|
||||
for database in "$DOTFILES"/scripts/install-cheat-*.sh; do
|
||||
@@ -163,12 +151,6 @@ section_install()
|
||||
&& msgr yay "github cli extensions installed!"
|
||||
;;
|
||||
|
||||
go)
|
||||
msgr run "Installing Go Packages..."
|
||||
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
||||
&& msgr yay "go packages installed!"
|
||||
;;
|
||||
|
||||
imagick)
|
||||
msgr run "Downloading and installing ImageMagick CLI..."
|
||||
curl -L https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||
@@ -182,33 +164,21 @@ section_install()
|
||||
&& msgr yay "macOS defaults set!"
|
||||
;;
|
||||
|
||||
nvm)
|
||||
msgr run "Installing nvm..."
|
||||
local NVM_VERSION
|
||||
NVM_VERSION=$(x-gh-get-latest-version nvm-sh/nvm)
|
||||
msgr ok "Latest nvm version: $NVM_VERSION"
|
||||
local NVM_INSTALL="https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh"
|
||||
local NVM_CURL="curl -o- \"$NVM_INSTALL\" | bash"
|
||||
PROFILE=/dev/null bash -c "$NVM_CURL"
|
||||
$0 install nvm-latest
|
||||
msgr yay "nvm installed!"
|
||||
;;
|
||||
|
||||
nvm-latest)
|
||||
msgr run "Installing latest lts node..."
|
||||
if [ -n "$NVM_DIR" ]; then
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
mise)
|
||||
msgr run "Installing tools via mise..."
|
||||
if ! command -v mise &> /dev/null; then
|
||||
msgr nested "Installing mise..."
|
||||
curl -fsSL https://mise.run | sh || { msgr err "Failed to install mise"; exit 1; }
|
||||
export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH"
|
||||
fi
|
||||
nvm install --lts --latest-npm --default
|
||||
git checkout "$DOTFILES/base/zshrc"
|
||||
git checkout "$DOTFILES/base/bashrc"
|
||||
msgr yay "latest lts node installed!"
|
||||
mise install --yes || { msgr err "mise install failed"; exit 1; }
|
||||
mise reshim || { msgr err "mise reshim failed"; exit 1; }
|
||||
msgr yay "mise tools installed!"
|
||||
;;
|
||||
|
||||
npm-packages)
|
||||
msgr run "NPM Packages install started..."
|
||||
bash "$DOTFILES/scripts/install-npm-packages.sh" \
|
||||
&& msgr yay "NPM Packages have been installed!"
|
||||
mise-cleanup)
|
||||
msgr run "Cleaning up old version manager installations..."
|
||||
bash "$DOTFILES/scripts/cleanup-old-version-managers.sh" "${@:2}"
|
||||
;;
|
||||
|
||||
apt-packages)
|
||||
@@ -235,10 +205,10 @@ section_install()
|
||||
&& msgr yay "ntfy installed!"
|
||||
;;
|
||||
|
||||
python-packages)
|
||||
msgr run "Installing Python packages..."
|
||||
python-libs)
|
||||
msgr run "Installing Python libraries..."
|
||||
bash "$DOTFILES/scripts/install-python-packages.sh" \
|
||||
&& msgr yay "Python packages installed!"
|
||||
&& msgr yay "Python libraries installed!"
|
||||
;;
|
||||
|
||||
xcode-cli-tools)
|
||||
@@ -289,8 +259,11 @@ section_brew()
|
||||
;;
|
||||
|
||||
update)
|
||||
brew update && brew outdated && brew upgrade && brew cleanup
|
||||
msgr yay "Done!"
|
||||
if brew update && brew outdated && brew upgrade && brew cleanup; then
|
||||
msgr yay "Done!"
|
||||
else
|
||||
msgr err "brew update failed"
|
||||
fi
|
||||
;;
|
||||
|
||||
updatebundle)
|
||||
@@ -549,9 +522,9 @@ section_dotfiles()
|
||||
case "$1" in
|
||||
fmt)
|
||||
msgr run "Running all formatters"
|
||||
$0 dotfiles yamlfmt
|
||||
$0 dotfiles shfmt
|
||||
msgr run_done "...done!"
|
||||
$0 dotfiles yamlfmt \
|
||||
&& $0 dotfiles shfmt \
|
||||
&& msgr run_done "...done!"
|
||||
;;
|
||||
|
||||
reset_all)
|
||||
@@ -565,11 +538,11 @@ section_dotfiles()
|
||||
~/.local/share/nvim \
|
||||
~/.local/state/nvim \
|
||||
~/.cache/nvim \
|
||||
~/.config/nvim
|
||||
msgr ok "Deleted old nvim files (share, state and cache + config)"
|
||||
ln -s "$DOTFILES/config/nvim" ~/.config/nvim
|
||||
msgr ok "Linked nvim and astronvim"
|
||||
x-have npm && $0 install npm
|
||||
~/.config/nvim \
|
||||
&& msgr ok "Deleted old nvim files (share, state and cache + config)"
|
||||
ln -s "$DOTFILES/config/nvim" ~/.config/nvim \
|
||||
&& msgr ok "Linked nvim and astronvim"
|
||||
$0 install mise || { msgr err "Failed to install mise tools"; exit 1; }
|
||||
msgr ok "Installed packages"
|
||||
msgr run_done "nvim reset!"
|
||||
;;
|
||||
@@ -593,8 +566,8 @@ section_dotfiles()
|
||||
--language-dialect bash \
|
||||
--func-next-line --list --write \
|
||||
--indent 2 --case-indent --space-redirects \
|
||||
--binary-next-line {} \;
|
||||
msgr yay "dotfiles have been shfmt formatted!"
|
||||
--binary-next-line {} \; \
|
||||
&& msgr yay "dotfiles have been shfmt formatted!"
|
||||
;;
|
||||
|
||||
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
|
||||
|
||||
136
scripts/cleanup-old-version-managers.sh
Normal file
136
scripts/cleanup-old-version-managers.sh
Normal file
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# @description Remove old version manager installations replaced by mise.
|
||||
# This script targets specific known directories — NOT which/command -v,
|
||||
# because nvim's Mason installs some of the same tool names.
|
||||
#
|
||||
# Ensure DOTFILES is set even when script is invoked directly
|
||||
if [[ -z "${DOTFILES:-}" ]]; then
|
||||
DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
export DOTFILES
|
||||
fi
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
DRY_RUN=""
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if [[ "$1" = "--dry-run" ]]; then
|
||||
DRY_RUN="--dry-run"
|
||||
else
|
||||
echo "Usage: $0 [--dry-run]" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
remove_dir()
|
||||
{
|
||||
local dir="$1" label="$2"
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
msgr ok "$label not found (already clean): $dir"
|
||||
return 0
|
||||
fi
|
||||
if [[ "$DRY_RUN" = "--dry-run" ]]; then
|
||||
msgr warn "[DRY RUN] Would remove $label: $dir"
|
||||
else
|
||||
msgr run "Removing $label: $dir"
|
||||
rm -rf "$dir"
|
||||
msgr run_done "Removed $label"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_file()
|
||||
{
|
||||
local file="$1" label="$2"
|
||||
[[ ! -f "$file" ]] && return 0
|
||||
if [[ "$DRY_RUN" = "--dry-run" ]]; then
|
||||
msgr warn "[DRY RUN] Would remove $label: $file"
|
||||
else
|
||||
rm -f "$file"
|
||||
msgr run_done "Removed $label: $file"
|
||||
fi
|
||||
}
|
||||
|
||||
msgr msg "Cleaning up old version manager installations..."
|
||||
msgr msg "Mason binaries in \$XDG_DATA_HOME/nvim/mason/ will NOT be touched."
|
||||
|
||||
# --- Version manager data directories ---
|
||||
|
||||
# nvm (Node Version Manager)
|
||||
remove_dir "$XDG_DATA_HOME/nvm" "nvm data"
|
||||
|
||||
# fnm (Fast Node Manager)
|
||||
remove_dir "$XDG_DATA_HOME/fnm" "fnm data"
|
||||
|
||||
# pyenv
|
||||
remove_dir "$XDG_DATA_HOME/pyenv" "pyenv data"
|
||||
|
||||
# goenv
|
||||
remove_dir "$XDG_DATA_HOME/goenv" "goenv data"
|
||||
|
||||
# bob-nvim (neovim version manager — mise manages neovim now)
|
||||
remove_dir "$XDG_DATA_HOME/bob" "bob-nvim data"
|
||||
|
||||
# --- Cargo-installed tool binaries ---
|
||||
# These were installed via `cargo install` into $CARGO_HOME/bin.
|
||||
# mise now manages them via ubi/cargo backends into its own install dirs.
|
||||
# Only remove from the OLD cargo bin location, not from XDG_BIN_HOME.
|
||||
|
||||
CARGO_BIN="${XDG_DATA_HOME}/cargo/bin"
|
||||
CARGO_MANAGED_TOOLS=(
|
||||
bkt btm difft eza fd rg
|
||||
tree-sitter tmux-sessionizer zoxide bob
|
||||
cargo-install-update cargo-cache
|
||||
)
|
||||
for tool in "${CARGO_MANAGED_TOOLS[@]}"; do
|
||||
remove_file "$CARGO_BIN/$tool" "cargo-installed $tool"
|
||||
done
|
||||
|
||||
# --- Go-installed tool binaries ---
|
||||
# go install puts binaries in $GOBIN (= $XDG_BIN_HOME) or $GOPATH/bin.
|
||||
# Only remove from $GOPATH/bin if it differs from XDG_BIN_HOME.
|
||||
GO_BIN="${XDG_DATA_HOME}/go/bin"
|
||||
GO_MANAGED_TOOLS=(
|
||||
yamlfmt cheat glow fzf gum sesh git-profile
|
||||
)
|
||||
if [[ "$GO_BIN" != "$XDG_BIN_HOME" ]] && [[ -d "$GO_BIN" ]]; then
|
||||
for tool in "${GO_MANAGED_TOOLS[@]}"; do
|
||||
remove_file "$GO_BIN/$tool" "go-installed $tool"
|
||||
done
|
||||
fi
|
||||
|
||||
# --- npm global binaries ---
|
||||
# These were installed via `npm install -g` into the nvm/fnm node prefix.
|
||||
# Since we removed nvm/fnm data dirs above, these are already gone.
|
||||
|
||||
# --- Python tools via uv tool ---
|
||||
# uv tool binaries go to ~/.local/bin/ (XDG_BIN_HOME).
|
||||
# mise pipx backend installs to a different location.
|
||||
# We leave XDG_BIN_HOME alone and let mise take precedence via PATH.
|
||||
|
||||
# --- Homebrew-installed version managers ---
|
||||
# These will be removed when `brew bundle cleanup` runs after Brewfile update.
|
||||
if command -v brew &> /dev/null; then
|
||||
BREW_REMOVE=(
|
||||
pyenv pyenv-pip-migrate pyenv-virtualenv goenv cargo-binstall
|
||||
act age ansible ansible-lint awscli bat bats-core checkov
|
||||
choose-rust cmake gdu gh grype jq onefetch pinact shellcheck
|
||||
tfenv tflint tfsec uv virtualenv wakatime-cli
|
||||
)
|
||||
for pkg in "${BREW_REMOVE[@]}"; do
|
||||
if brew list "$pkg" &> /dev/null; then
|
||||
if [[ "$DRY_RUN" = "--dry-run" ]]; then
|
||||
msgr warn "[DRY RUN] Would brew uninstall $pkg"
|
||||
else
|
||||
msgr run "Uninstalling brew package: $pkg"
|
||||
msgr warn "Note: $pkg may have dependents"
|
||||
if brew uninstall "$pkg"; then
|
||||
msgr run_done "Uninstalled $pkg"
|
||||
else
|
||||
msgr err "Failed to uninstall $pkg"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
msgr yay "Cleanup complete! Run 'mise install' to set up tools via mise."
|
||||
Reference in New Issue
Block a user