1
0
mirror of https://codeberg.org/diginaut/dotfiles.git synced 2026-02-04 11:10:26 +01:00

uv direnv support

This commit is contained in:
2025-12-30 22:08:26 +01:00
parent fe4c5bd146
commit fa2ff5074c

19
.config/direnv/direnvrc Normal file
View File

@@ -0,0 +1,19 @@
layout_uv() {
if [[ -d ".venv" ]]; then
VIRTUAL_ENV="$(pwd)/.venv"
fi
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
log_status "No virtual environment exists. Executing \`uv venv\` to create one."
uv venv
VIRTUAL_ENV="$(pwd)/.venv"
fi
if [ -d ".venv/bin" ]; then
PATH_add .venv/bin
elif [ -d ".venv/Scripts" ]; then
PATH_add .venv/Scripts
fi
export UV_ACTIVE=1 # or VENV_ACTIVE=1
export VIRTUAL_ENV
}