diff --git a/install.sh b/install.sh index 7026595..ef1eda9 100755 --- a/install.sh +++ b/install.sh @@ -114,6 +114,9 @@ install_packages "${MEDIA[@]}" echo "Installing fonts..." install_packages "${FONTS[@]}" +echo "Installing pipx applications..." +install_pipx_apps "${PIPX[@]}" + # Enable all systemd services listed in SERVICES array, then register the SSH # Avahi service so the machine is discoverable over mDNS echo "Configuring services..." diff --git a/packages.conf b/packages.conf index 71cb326..e95495e 100644 --- a/packages.conf +++ b/packages.conf @@ -84,6 +84,7 @@ DEV_TOOLS=( python-myst-parser python-pillow python-pip + python-pipx python-pygments rust starship @@ -134,6 +135,11 @@ FONTS=( ttf-nerd-fonts-symbols ) +# Python applications installed with pipx +PIPX=( + terrahour +) + # Services to enable SERVICES=( avahi-daemon.service diff --git a/updates.d/40-ruby.sh b/updates.d/40-ruby.sh index 4d05984..baaa207 100644 --- a/updates.d/40-ruby.sh +++ b/updates.d/40-ruby.sh @@ -9,4 +9,8 @@ mise self-update -y echo "Updating Ruby and Rails..." mise upgrade --bump ruby mise reshim +# A new Ruby's bundled gems (e.g. minitest) come with executables RubyGems +# doesn't recognise as its own, so gem update stops to ask whether to overwrite +# them. Regenerating them first lets the update go through without asking. +gem pristine --all --only-executables > /dev/null gem update diff --git a/updates.d/60-pipx.sh b/updates.d/60-pipx.sh index ef5602a..0ba9fe2 100644 --- a/updates.d/60-pipx.sh +++ b/updates.d/60-pipx.sh @@ -1,5 +1,15 @@ #!/bin/bash +COREDESKTOP="$HOME/.local/share/coredesktop" + +source "$COREDESKTOP/utils.sh" +source "$COREDESKTOP/packages.conf" + +STATUS=0 + +echo "Checking for new pipx applications..." +install_pipx_apps "${PIPX[@]}" || STATUS=1 + # pipx venvs are tied to the Python they were built with, so a Python upgrade # breaks them in a way `pipx upgrade-all` can't repair. Rebuild them when the # Python version changes, or when an upgrade fails. @@ -15,4 +25,6 @@ else echo "pipx upgrade-all failed, reinstalling pipx applications..." pipx reinstall-all fi -fi && mkdir -p "$(dirname "$STAMP")" && echo "$CURRENT_PYTHON" > "$STAMP" +fi && mkdir -p "$(dirname "$STAMP")" && echo "$CURRENT_PYTHON" > "$STAMP" || STATUS=1 + +exit $STATUS diff --git a/utils.sh b/utils.sh index 7444007..fdc85fc 100755 --- a/utils.sh +++ b/utils.sh @@ -27,6 +27,20 @@ install_packages() { fi } +# Function to install pipx applications if not already installed +install_pipx_apps() { + local installed app status=0 + installed="$(pipx list --short 2> /dev/null | cut -d' ' -f1)" + + for app in "$@"; do + if ! grep -qx "$app" <<< "$installed"; then + echo "Installing $app with pipx..." + pipx install "$app" || status=1 + fi + done + return $status +} + # Function to remove pacman/AUR packages if installed remove_packages() { local packages=("$@")