diff --git a/.config/direnv/direnvrc b/.config/direnv/direnvrc new file mode 100644 index 0000000..d4deef9 --- /dev/null +++ b/.config/direnv/direnvrc @@ -0,0 +1,33 @@ +layout_uv_venv() { + 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 + + PATH_add "$VIRTUAL_ENV/bin" + export UV_ACTIVE=1 # or VENV_ACTIVE=1 + export VIRTUAL_ENV +} + +layout_uv() { + if [[ -d ".venv" ]]; then + VIRTUAL_ENV="$(pwd)/.venv" + fi + + if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then + log_status "No uv project exists. Executing \`uv init\` to create one." + uv init --no-readme + rm hello.py + uv venv + VIRTUAL_ENV="$(pwd)/.venv" + fi + + PATH_add "$VIRTUAL_ENV/bin" + export UV_ACTIVE=1 # or VENV_ACTIVE=1 + export VIRTUAL_ENV +} diff --git a/install.conf.yaml b/install.conf.yaml index 576f89d..8025758 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -10,6 +10,7 @@ ~/.config/alacritty: .config/alacritty ~/.config/zellij/: .config/zellij ~/.config/yazi/: .config/yazi + ~/.config/direnv: .config/direnv ~/.config/git/: .config/git/ ~/.config/starship.toml: .config/starship.toml ~/.config/i3: .config/i3/