-
Notifications
You must be signed in to change notification settings - Fork 9
/
flake.nix
65 lines (58 loc) · 2.07 KB
/
flake.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
58
59
60
61
62
63
64
65
{
description = "spiking neural network simulator";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }: {
flake-utils.lib.eachDefaultSystem
(system:
let
python = nixpkgs.python39Packages;
pkgs = import nixpkgs { inherit system };
requirements = ''
norse
matplotlib
jupyter-book
'';
in rec {
devShell = pkgs.mkShell {
name = "norse";
nativeBuildInputs = with pkgs; [
python
];
}
}
nixpkgs.mkShell rec {
name = "impurePythonEnv";
venvDir = "./.venv";
buildInputs = [
# A Python interpreter including the 'venv' module is required to bootstrap
# the environment.
pythonPackages.python
# This execute some shell code to initialize a venv in $venvDir before
# dropping into the shell
pythonPackages.venvShellHook
# Those are dependencies that we would like to use from nixpkgs, which will
# add them to PYTHONPATH and thus make them accessible from within the venv.
pythonPackages.matplotlib
pythonPackages.jupyter
pythonPackages.pytorch
pythonPackages.pybind11
pythonPackages.pytest
cmake ninja
];
# Run this command, only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install --upgrade pip
pip install -r requirements.txt
'';
# Now we can execute any commands within the virtual environment.
# This is optional and can be left out to run pip manually.
postShellHook = ''
export LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
}
);
}
}