grzegorz/.envrc

29 lines
872 B
Plaintext
Raw Normal View History

2022-02-19 23:04:14 +01:00
#!/usr/bin/env bash
# This file is loaded with `direnv`.
# It enters you into the poetry venv, removing the need for `poetry run`.
2022-08-27 22:27:55 +02:00
if command -v nix >/dev/null; then
2024-05-10 19:57:29 +02:00
use flake
2022-08-27 22:27:55 +02:00
fi
2024-05-10 19:57:29 +02:00
export GRZEGORZ_IS_DEBUG=1 # mpv does not start in fullscreen
2022-08-27 22:27:55 +02:00
# 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
2022-02-19 23:04:14 +01:00
export VIRTUAL_ENV=$(poetry env info --path)
export POETRY_ACTIVE=1
PATH_add "$VIRTUAL_ENV/bin"
2022-08-27 22:27:55 +02:00
if ! command -v sanic >/dev/null; then
poetry install
2024-05-10 19:57:29 +02:00
# 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
2022-08-27 22:27:55 +02:00
fi