grzegorz/.envrc
2024-05-10 20:03:52 +02:00

29 lines
872 B
Bash

#!/usr/bin/env bash
# This file is loaded with `direnv`.
# It enters you into the poetry venv, removing the need for `poetry run`.
if command -v nix >/dev/null; then
use flake
fi
export GRZEGORZ_IS_DEBUG=1 # mpv does not start in fullscreen
# Instead of using the flake, we use poetry to manage a development venv
# We only use poetry2nix for deployment
# create venv if it doesn't exist
poetry run true
# enter venv
export VIRTUAL_ENV=$(poetry env info --path)
export POETRY_ACTIVE=1
PATH_add "$VIRTUAL_ENV/bin"
if ! command -v sanic >/dev/null; then
poetry install
# patchelf the venv on nixos
if ! test -s /lib64/ld-linux-x86-64.so.2 || { uname -a | grep -qi nixos; }; then
#nix run github:GuillaumeDesforges/fix-python -- --venv "$VIRTUAL_ENV" #--libs .nix/libs.nix
fix-python --venv "$VIRTUAL_ENV" #--libs .nix/libs.nix
fi
fi