mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-19 04:06:08 +00:00
feat: migrate to mise for unified tool management (#309)
This commit is contained in:
20
scripts/cleanup-old-version-managers.md
Normal file
20
scripts/cleanup-old-version-managers.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# cleanup-old-version-managers
|
||||
|
||||
Remove old version manager installations that have been replaced by mise.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
scripts/cleanup-old-version-managers.sh [--dry-run]
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. Removes data directories for nvm, fnm, pyenv, goenv, and bob-nvim.
|
||||
2. Removes cargo-installed tool binaries now managed by mise.
|
||||
3. Removes go-installed tool binaries from `$GOPATH/bin`.
|
||||
4. Uninstalls Homebrew packages replaced by mise (if brew is available).
|
||||
|
||||
Mason binaries (`$XDG_DATA_HOME/nvim/mason/`) are not touched.
|
||||
|
||||
Pass `--dry-run` to preview what would be removed without making changes.
|
||||
4
scripts/cleanup-old-version-managers.sh
Normal file → Executable file
4
scripts/cleanup-old-version-managers.sh
Normal file → Executable file
@@ -36,6 +36,7 @@ remove_dir()
|
||||
rm -rf "$dir"
|
||||
msgr run_done "Removed $label"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
remove_file()
|
||||
@@ -48,6 +49,7 @@ remove_file()
|
||||
rm -f "$file"
|
||||
msgr run_done "Removed $label: $file"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
msgr msg "Cleaning up old version manager installations..."
|
||||
@@ -133,4 +135,4 @@ if command -v brew &> /dev/null; then
|
||||
done
|
||||
fi
|
||||
|
||||
msgr yay "Cleanup complete! Run 'mise install' to set up tools via mise."
|
||||
msgr yay "Cleanup complete! Run 'mise install' to set up tools via mise."
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# install-cargo-packages
|
||||
|
||||
Install Rust packages defined in the script.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
scripts/install-cargo-packages.sh
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. If `cargo-install-update` is available, updates all existing packages first
|
||||
and tracks which packages are already installed.
|
||||
2. Installs each package from the inline list using `cargo install`,
|
||||
skipping any already handled by the update step.
|
||||
Builds run in parallel using available CPU cores (minus two).
|
||||
3. Runs package-specific post-install steps.
|
||||
4. Cleans the cargo cache with `cargo cache --autoclean`.
|
||||
|
||||
To add or remove packages, edit the `packages` array in `scripts/install-cargo-packages.sh`.
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
# @description Install cargo/rust packages.
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
msgr run "Starting to install rust/cargo packages"
|
||||
|
||||
# Track packages already managed by cargo install-update
|
||||
declare -A installed_packages
|
||||
|
||||
# If we have cargo install-update, use it first
|
||||
if command -v cargo-install-update &> /dev/null; then
|
||||
msgr run "Updating cargo packages with cargo install-update"
|
||||
# Show output in real-time (via stderr) while capturing it for parsing
|
||||
update_output=$(cargo install-update -a 2>&1 | tee /dev/stderr)
|
||||
msgr run_done "Done with cargo install-update"
|
||||
|
||||
# Parse installed package names from the update output
|
||||
while IFS= read -r pkg_name; do
|
||||
[[ -n "$pkg_name" ]] && installed_packages["$pkg_name"]=1
|
||||
done < <(echo "$update_output" | awk '/v[0-9]+\.[0-9]+/ { print $1 }')
|
||||
fi
|
||||
|
||||
# Cargo packages to install
|
||||
packages=(
|
||||
cargo-update # A cargo subcommand for checking and applying updates to installed executables
|
||||
cargo-cache # Cargo cache management utility
|
||||
tree-sitter-cli # An incremental parsing system for programming tools
|
||||
bkt # A subprocess caching utility
|
||||
difftastic # A structural diff that understands syntax
|
||||
fd-find # A simple, fast and user-friendly alternative to 'find'
|
||||
ripgrep # Recursively searches directories for a regex pattern while respecting your gitignore
|
||||
bob-nvim # A version manager for neovim
|
||||
bottom # A cross-platform graphical process/system monitor
|
||||
eza # A modern alternative to ls
|
||||
tmux-sessionizer # A tool for opening git repositories as tmux sessions
|
||||
zoxide # A smarter cd command
|
||||
)
|
||||
|
||||
# Number of jobs to run in parallel, this helps to keep the system responsive
|
||||
BUILD_JOBS=$(nproc --ignore=2 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 1)
|
||||
|
||||
# Function to install cargo packages
|
||||
install_packages()
|
||||
{
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Skip packages already handled by cargo install-update
|
||||
if [[ -n "${installed_packages[$pkg]+x}" ]]; then
|
||||
msgr ok "Skipping $pkg (already installed)"
|
||||
continue
|
||||
fi
|
||||
|
||||
msgr run "Installing cargo package $pkg"
|
||||
cargo install --jobs "$BUILD_JOBS" "$pkg"
|
||||
msgr run_done "Done installing $pkg"
|
||||
echo ""
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to perform additional steps for installed cargo packages
|
||||
post_install_steps()
|
||||
{
|
||||
msgr run "Now doing the next steps for cargo packages"
|
||||
|
||||
# use bob to install latest stable nvim
|
||||
if command -v bob &> /dev/null; then
|
||||
bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin"
|
||||
fi
|
||||
|
||||
msgr run "Removing cargo cache"
|
||||
cargo cache --autoclean
|
||||
msgr "done" "Done removing cargo cache"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install cargo packages and run post-install steps
|
||||
main()
|
||||
{
|
||||
install_packages
|
||||
msgr "done" "Installed cargo packages!"
|
||||
post_install_steps
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -51,8 +51,8 @@ install_fonts()
|
||||
{
|
||||
msgr run "Starting to install NerdFonts..."
|
||||
# shellcheck disable=SC2048,SC2086
|
||||
./install.sh -q -s ${fonts[*]}
|
||||
msgr run_done "Done"
|
||||
./install.sh -q -s ${fonts[*]} \
|
||||
&& msgr run_done "Done"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ install_extensions()
|
||||
# Install all GitHub CLI extensions
|
||||
main()
|
||||
{
|
||||
install_extensions
|
||||
msgr run_done "Done"
|
||||
install_extensions \
|
||||
&& msgr run_done "Done"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# install-go-packages
|
||||
|
||||
Install Go packages defined in the script.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
scripts/install-go-packages.sh
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. Checks that `go` is available.
|
||||
2. Installs each package from the inline list using `go install`.
|
||||
3. Runs post-install steps (e.g. generating shell completions).
|
||||
4. Clears the Go module and build caches.
|
||||
|
||||
To add or remove packages, edit the `packages` array in `scripts/install-go-packages.sh`.
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# @description Install Go packages
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
msgr run "Installing go packages"
|
||||
|
||||
! x-have "go" && msgr err "go hasn't been installed yet." && exit 0
|
||||
|
||||
# Go packages to install
|
||||
packages=(
|
||||
github.com/dotzero/git-profile@latest # Switch between git user profiles
|
||||
github.com/google/yamlfmt/cmd/yamlfmt@latest # Format yaml files
|
||||
github.com/cheat/cheat/cmd/cheat@latest # Interactive cheatsheets on the CLI
|
||||
github.com/charmbracelet/glow@latest # Render markdown on the CLI
|
||||
github.com/junegunn/fzf@latest # General-purpose fuzzy finder
|
||||
github.com/charmbracelet/gum@latest # Glamorous shell scripts
|
||||
github.com/joshmedeski/sesh/v2@latest # Terminal session manager
|
||||
)
|
||||
|
||||
# Function to install go packages
|
||||
install_packages()
|
||||
{
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
pkg="${pkg// /}"
|
||||
[[ -z "$pkg" ]] && continue
|
||||
|
||||
msgr nested "Installing go package: $pkg"
|
||||
go install "$pkg"
|
||||
echo ""
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to install completions and run actions for selected packages
|
||||
post_install()
|
||||
{
|
||||
msgr run "Installing completions for selected packages"
|
||||
|
||||
if command -v git-profile &> /dev/null; then
|
||||
git-profile completion zsh > "$ZSH_CUSTOM_COMPLETION_PATH/_git-profile" \
|
||||
&& msgr run_done "Installed completions for git-profile"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to clear go cache
|
||||
clear_go_cache()
|
||||
{
|
||||
msgr run "Clearing go cache"
|
||||
go clean -cache -modcache
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install go packages, completions, and clear cache
|
||||
main()
|
||||
{
|
||||
install_packages
|
||||
post_install
|
||||
clear_go_cache
|
||||
msgr run_done "Done"
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,18 +0,0 @@
|
||||
# install-npm-packages
|
||||
|
||||
Install npm packages defined in the script.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
scripts/install-npm-packages.sh
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. Checks that `npm` is available.
|
||||
2. Installs each package from the inline list using `npm install -g`.
|
||||
3. Upgrades all global packages.
|
||||
4. Cleans the npm cache.
|
||||
|
||||
To add or remove packages, edit the `packages` array in `scripts/install-npm-packages.sh`.
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# @description Install npm packages globally.
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
msgr msg "Starting to install npm packages"
|
||||
|
||||
if ! command -v npm &> /dev/null; then
|
||||
msgr err "npm could not be found."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
packages=(
|
||||
editorconfig-checker # Check files against .editorconfig rules
|
||||
github-release-notes # Create release notes from tags and issues
|
||||
neovim # Neovim node client
|
||||
corepack # Node.js package manager version management
|
||||
)
|
||||
|
||||
# Function to install npm packages
|
||||
install_packages()
|
||||
{
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
pkg="${pkg// /}"
|
||||
[[ -z "$pkg" ]] && continue
|
||||
|
||||
if npm ls -g -p "$pkg" &> /dev/null; then
|
||||
msgr run_done "$pkg" "already installed"
|
||||
else
|
||||
msgr run "Installing npm package:" "$pkg"
|
||||
npm install -g --no-fund --no-progress --no-timing "$pkg"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to upgrade all global npm packages
|
||||
upgrade_global_packages()
|
||||
{
|
||||
msgr run "Upgrading all global packages"
|
||||
npm -g --no-progress --no-timing --no-fund outdated || true
|
||||
npm -g --no-timing --no-fund upgrade
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to clean npm cache
|
||||
clean_npm_cache()
|
||||
{
|
||||
msgr run "Cleaning up npm cache"
|
||||
npm cache verify
|
||||
npm cache clean --force
|
||||
npm cache verify
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install, upgrade, and clean npm packages
|
||||
main()
|
||||
{
|
||||
install_packages
|
||||
upgrade_global_packages
|
||||
clean_npm_cache
|
||||
msgr yay "npm package installations complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -1,6 +1,6 @@
|
||||
# install-python-packages
|
||||
|
||||
Install Python packages defined in the script using `uv`.
|
||||
Install Python **libraries** (not tools — those are managed by mise).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -10,9 +10,7 @@ scripts/install-python-packages.sh
|
||||
|
||||
## What it does
|
||||
|
||||
1. Checks that `uv` is available; if missing, installs it via the official installer.
|
||||
2. Installs each CLI tool from the inline `tools` array using `uv tool install --upgrade`.
|
||||
3. Installs each library from the inline `libraries` array using `uv pip install --system --upgrade`.
|
||||
4. Upgrades all uv-managed tools with `uv tool upgrade --all`.
|
||||
1. Checks that `uv` is available; if missing, exits with an error (install `uv` via mise first).
|
||||
2. Installs each library from the inline `libraries` array using `uv pip install --system --upgrade`.
|
||||
|
||||
To add or remove packages, edit the `tools` or `libraries` arrays in `scripts/install-python-packages.sh`.
|
||||
To add or remove packages, edit the `libraries` array in `scripts/install-python-packages.sh`.
|
||||
|
||||
@@ -1,53 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
# @description Install Python packages using uv.
|
||||
# @description Install Python libraries via uv pip (tools are managed by mise).
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/config/shared.sh"
|
||||
|
||||
msgr run "Starting to install Python packages"
|
||||
msgr run "Starting to install Python libraries"
|
||||
|
||||
# Ensure uv is available
|
||||
if ! command -v uv &> /dev/null; then
|
||||
msgr nested "uv not found, installing via official installer"
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
msgr err "uv not found — install it via mise first (run: dfm install mise)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# CLI tools — installed isolated with `uv tool install`
|
||||
tools=(
|
||||
ansible # IT automation and configuration management
|
||||
openapi-python-client # Generate Python API clients from OpenAPI specs
|
||||
ruff # Fast Python linter and formatter
|
||||
)
|
||||
|
||||
# Library packages — installed into system Python with `uv pip install --system`
|
||||
libraries=(
|
||||
libtmux # Python API for tmux
|
||||
pynvim # Neovim Python client
|
||||
)
|
||||
|
||||
# Function to install CLI tools via uv tool install
|
||||
install_tools()
|
||||
{
|
||||
msgr run "Installing Python CLI tools"
|
||||
for pkg in "${tools[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
pkg="${pkg// /}"
|
||||
[[ -z "$pkg" ]] && continue
|
||||
|
||||
msgr nested "Installing tool: $pkg"
|
||||
uv tool install --upgrade "$pkg"
|
||||
echo ""
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to install library packages via uv pip install
|
||||
install_libraries()
|
||||
{
|
||||
msgr run "Installing Python libraries"
|
||||
for pkg in "${libraries[@]}"; do
|
||||
# Strip inline comments and trim whitespace
|
||||
pkg="${pkg%%#*}"
|
||||
@@ -61,22 +35,5 @@ install_libraries()
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to upgrade all uv-managed tools
|
||||
upgrade_tools()
|
||||
{
|
||||
msgr run "Upgrading all uv-managed tools"
|
||||
uv tool upgrade --all
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install Python tools, libraries, and upgrade all
|
||||
main()
|
||||
{
|
||||
install_tools
|
||||
install_libraries
|
||||
upgrade_tools
|
||||
msgr yay "Python package installations complete"
|
||||
return 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
install_libraries \
|
||||
&& msgr yay "Python library installations complete"
|
||||
|
||||
@@ -23,8 +23,8 @@ install_shellspec()
|
||||
fi
|
||||
|
||||
msgr run "Running make install..."
|
||||
make -C "$SHELLSPEC_CACHE" install PREFIX="$HOME/.local"
|
||||
msgr run_done "shellspec $version installed to $HOME/.local/bin/shellspec"
|
||||
make -C "$SHELLSPEC_CACHE" install PREFIX="$HOME/.local" \
|
||||
&& msgr run_done "shellspec $version installed to $HOME/.local/bin/shellspec"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ clone_z_repo()
|
||||
local bin_path=$2
|
||||
|
||||
if [[ ! -d "$bin_path" ]]; then
|
||||
git clone "$git_path" "$bin_path"
|
||||
msgr run_done "z installed at $bin_path"
|
||||
git clone "$git_path" "$bin_path" \
|
||||
&& msgr run_done "z installed at $bin_path"
|
||||
else
|
||||
msgr ok "z ($bin_path/) already installed"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user