-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.envrc
34 lines (28 loc) · 996 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
34
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake
# If the .venv folder doesn't exist, create a virtualenv.
if [ ! -d .venv ]; then
python3 -m venv .venv
rm -rf .direnv/requirements.txt
rm -rf .direnv/dev-requirements.txt
fi
# Activate the virtualenv
source .venv/bin/activate
# Install the project dependencies
cached_req=$(expand_path .direnv/requirements.txt)
if ! cmp -s $cached_req requirements.txt; then
mkdir -p .direnv
pip install -r requirements.txt
cp requirements.txt $cached_req
fi
cached_devreq=$(expand_path .direnv/dev-requirements.txt)
if ! cmp -s $cached_devreq dev-requirements.txt; then
mkdir -p .direnv
pip install -r dev-requirements.txt
cp dev-requirements.txt $cached_devreq
fi
watch_file requirements.txt
watch_file dev-requirements.txt
watch_file shell.nix