forked from gaussalgo/ga-st-python-course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
33 lines (28 loc) · 796 Bytes
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export NIXPKGS_ALLOW_UNFREE=1
if [[ ! $WITHOUT_NIX_PLEASE ]]; then
if type lorri &>/dev/null; then
# https://github.com/target/lorri
eval "$(lorri direnv)"
else
# fall back to using direnv's builtin nix support
use nix
fi
fi
VIRTUAL_ENV="$PWD/venv"
if [ ! -e venv ]
then
python -m venv "${VIRTUAL_ENV}"
fi
export VIRTUAL_ENV
PATH_add "$VIRTUAL_ENV/bin"
if [[ ! $WITHOUT_NIX_PLEASE ]]; then
LAST_CHECK_SUM=$(cat .last_check_sum 2>/dev/null)
CHECK_SUM=$(find venv -type f -print0 | xargs -0 stat --format '%Y :%y %n' | md5sum | cut -d' ' -f 1)
if [ "$LAST_CHECK_SUM" != "$CHECK_SUM" ]
then
nix-shell --run 'autoPatchelf venv'
echo "$CHECK_SUM" > .last_check_sum
fi
fi
source .env
export $(cut -d= -f1 .env)