-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
103 lines (102 loc) · 2.89 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
description = "Computational Neuroscience Environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
py3Opt = pkgs.python3.override {
# enableOptimizations = true;
# reproducibleBuild = false;
self = py3Opt;
};
NEURON-src = pkgs.fetchurl {
url = "https://github.com/neuronsimulator/nrn/releases/download/8.2.1/full-src-package-8.2.1.tar.gz";
sha256 = "0kb0dn7nmivv3zflzkbj2fj3184zwp2crkxp0mdxkwm4kpnxqz0v";
};
NEURON = pkgs.stdenv.mkDerivation rec {
pname = "NEURON";
version = "8.2.1";
outputs = ["out" "wheel"];
propagatedNativeBuildInputs = (with pkgs; [
mpi
# TODO: X11 support
# xquartz
# xorg.libX11.dev
]);
nativeBuildInputs = (with pkgs; [
pkg-config
readline81.dev
cmake
bison
flex
git
py3Opt
py3Opt.pkgs.wheel
py3Opt.pkgs.setuptools
py3Opt.pkgs.scikit-build
py3Opt.pkgs.matplotlib
py3Opt.pkgs.bokeh
py3Opt.pkgs.ipython
py3Opt.pkgs.cython
py3Opt.pkgs.mpi4py
py3Opt.pkgs.numpy
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
xcbuild
]);
configurePhase = ''
sed -e 's#build/cmake_install#'"$out"'#'\
-i setup.py
'';
buildPhase = ''
python setup.py build_ext --disable-iv bdist_wheel
'';
# TODO: encode platform and python version
installPhase = ''
mkdir $out/dist
mkdir $wheel
cp dist/*.whl $wheel/
'';
src = NEURON-src;
};
NEURON-py = py3Opt.pkgs.buildPythonPackage rec {
pname = "NEURON";
version = "8.2.1";
propagatedBuildInputs = [
py3Opt.pkgs.setuptools
py3Opt.pkgs.scikit-build
py3Opt.pkgs.matplotlib
py3Opt.pkgs.bokeh
py3Opt.pkgs.ipython
py3Opt.pkgs.cython
py3Opt.pkgs.mpi4py
py3Opt.pkgs.numpy
];
format = "wheel";
src = let
dir = "${NEURON.wheel}/";
in
dir + (builtins.head (builtins.attrNames (builtins.readDir dir)));
};
mypy = py3Opt.withPackages (p: with p; [
NEURON-py
numpy
scipy
matplotlib
seaborn
pyyaml
tqdm
pathos
prompt_toolkit
python-lsp-server
]);
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = [
mypy
pkgs.readline81
];
};
});
}