forked from web2py/pydal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
32 lines (26 loc) · 836 Bytes
/
shell.nix
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
let
nixpkgs-src = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/nixos-23.05";
};
pkgs = import nixpkgs-src { };
myPython = pkgs.python311;
shell = pkgs.mkShell {
shellHook = ''
# Allow the use of wheels.
SOURCE_DATE_EPOCH=$(date +%s)
VENV_PATH=/home/$USER/.venvs$(pwd)/venv${myPython.version}
# Augment the dynamic linker path
# Setup the virtual environment if it doesn't already exist.
if test ! -d $VENV_PATH; then
python -m venv $VENV_PATH
fi
if test -e requirements.txt; then
$VENV_PATH/bin/pip install -U -r requirements.txt
fi
$VENV_PATH/bin/pip install build twine
source $VENV_PATH/bin/activate
export PYTHONPATH=$VENV_PATH/${myPython.sitePackages}/:$PYTHONPATH
'';
};
in
shell