From 0bcda4ccb4c71c2d5dab8e13179521b1dde53a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Jur=C4=8Da?= Date: Fri, 13 Mar 2026 18:49:31 +0100 Subject: [PATCH] Ensure uv is available on fresh installs Some uv install locations are not always present in the $PATH environment variable, e.g. $HOME/.local/bin until the directory is created. This patch replicates the uv install directory resolution and updates the $PATH variable to ensure the uv commands get executed. --- runs/speedrun.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/runs/speedrun.sh b/runs/speedrun.sh index fa50694..6c41718 100644 --- a/runs/speedrun.sh +++ b/runs/speedrun.sh @@ -20,6 +20,26 @@ mkdir -p $NANOCHAT_BASE_DIR # install uv (if not already installed) command -v uv &> /dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh +if ! command -v uv &> /dev/null; then + # uv installation path is not in $PATH, add it. This code mimics what the + # uv install script does to determine the install path. + + if [ -n "${XDG_BIN_HOME:-}" ]; then + _install_dir="$XDG_BIN_HOME" + elif [ -n "${XDG_DATA_HOME:-}" ]; then + _install_dir="$XDG_DATA_HOME/../bin" + else + if [ -n "${HOME:-}" ]; then + _inferred_home="$HOME" + elif [ -n "${USER:-}" ]; then + _inferred_home=$(getent passwd "$USER" | cut -d: -f6) + else + _inferred_home=$(getent passwd "$(id -un)" | cut -d: -f6) + fi + _install_dir="$_inferred_home/.local/bin" + fi + export PATH="$_install_dir:$PATH" +fi # create a .venv local virtual environment (if it doesn't exist) [ -d ".venv" ] || uv venv # install the repo dependencies