-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathshell.nix
More file actions
71 lines (58 loc) · 1.49 KB
/
shell.nix
File metadata and controls
71 lines (58 loc) · 1.49 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let
nixpkgs-src = builtins.fetchTarball {
# Master of Dec 21, 2023
url = "https://github.com/NixOS/nixpkgs/archive/08b802c343d93f4d09deeebf187f6ec8c3233124.tar.gz";
sha256 = "0zx0d52cpjr0nxfd3w2qzaaqbq83pj1iqw8300hsij9mhxlny3vw";
};
pkgs = import nixpkgs-src {
config = {
allowUnfree = true;
};
};
myPython = pkgs.python311;
pythonWithPkgs = myPython.withPackages (pythonPkgs:
with pythonPkgs; [
black # for formatting
pip
setuptools
virtualenvwrapper
wheel
]);
lib-path = with pkgs;
lib.makeLibraryPath [
libffi
openssl
stdenv.cc.cc
];
shell = pkgs.mkShell {
buildInputs = [
pythonWithPkgs
# pkgs.autoconf
# pkgs.pkg-config
# Misc packages needed for compiling python libs
pkgs.readline
pkgs.libffi
pkgs.openssl
# Necessary because of messing with LD_LIBRARY_PATH
pkgs.git
pkgs.openssh
pkgs.rsync
];
shellHook = ''
# Allow the use of wheels.
SOURCE_DATE_EPOCH=$(date +%s)
# Augment the dynamic linker path
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}"
# Setup the virtual environment if it doesn't already exist.
VENV=.venv
if test ! -d $VENV; then
virtualenv $VENV
fi
source ./$VENV/bin/activate
export PYTHONPATH=`pwd`/$VENV/${myPython.sitePackages}/:$PYTHONPATH
pip install -r requirements.txt
python main.py
'';
};
in
shell