mirror of
https://codeberg.org/diginaut/dotfiles.git
synced 2026-02-04 08:50:26 +01:00
uv direnv support
This commit is contained in:
19
.config/direnv/direnvrc
Normal file
19
.config/direnv/direnvrc
Normal 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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user