-
Notifications
You must be signed in to change notification settings - Fork 131
/
default.nix
57 lines (49 loc) · 1.28 KB
/
default.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
let
nixpkgs-src = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/tarball/nixos-23.05";
};
pkgs = import nixpkgs-src {};
# This is the Python version that will be used.
myPython = pkgs.python311;
pythonWithPkgs = myPython.withPackages (pythonPkgs: with pythonPkgs; [
pip
setuptools
wheel
twine
black
isort
pytest
]);
lib-path = with pkgs; lib.makeLibraryPath [
libffi
openssl
];
shell = pkgs.mkShell {
buildInputs = [
pythonWithPkgs
pkgs.zip
pkgs.memcached
pkgs.redis
pkgs.readline
pkgs.libffi
pkgs.openssl
pkgs.cmake
];
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
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${lib-path}"
# Setup the virtual environment if it doesn't already exist.
if test ! -d $VENV_PATH; then
python -m venv $VENV_PATH
fi
$VENV_PATH/bin/pip install -U -r requirements.txt
source $VENV_PATH/bin/activate
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
export PYTHONPATH=$VENV_PATH/${myPython.sitePackages}/:$PYTHONPATH
'';
};
in
shell