refactor(dfm): replace per-language install commands with mise

This commit is contained in:
2026-03-18 04:03:15 +02:00
parent 2d316bfed7
commit 425543b40a
9 changed files with 30 additions and 390 deletions

View 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
# Tier 2: Runtimes and CLI tools via mise, then remaining installers
$0 install mise
$0 install composer
$0 install nvm
$0 install npm-packages
$0 install python-packages
$0 install python-libs
# 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 https://mise.run | sh
export PATH="$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
mise reshim
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)

View File

@@ -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`.

View File

@@ -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 "$@"

View File

@@ -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`.

View File

@@ -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 "$@"

View File

@@ -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`.

View File

@@ -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 "$@"

View File

@@ -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
@@ -11,8 +11,6 @@ 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`.
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`.

View File

@@ -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"
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"