-
Notifications
You must be signed in to change notification settings - Fork 0
/
sagedoc.nix
242 lines (229 loc) · 4.47 KB
/
sagedoc.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
{ pkgs
, stdenv
, sage-src
, sagelib
, pygments
, ipython_5
, traitlets
, enum34
, ipython_genutils
, decorator
, pexpect
, ptyprocess
, backports_shutil_get_terminal_size
, pathlib2
, pickleshare
, prompt_toolkit
, wcwidth
, simplegeneric
, openblasCompat
, openblas-blas-pc
, openblas-cblas-pc
, openblas-lapack-pc
, pkgconfig
, psutil
, future
, singular
, sympy
, mpmath # TODO propagated by sympy
, fpylll
, libgap
, gap
, matplotlib
, scipy
, pyparsing
, cycler
, networkx
, dateutil # TODO propagated by matplotlib
, conway_polynomials
, graphs
, ecl
, pillow
, twisted
, cvxopt
, ipykernel
, ipywidgets
, rpy2
, sphinx
, sagenb
, docutils
, jupyter_client
, flask
, flask-babel
, flask-oldsessions
, flask-autoindex
, flask-openid
, flask-silk
, werkzeug # for notebook
, typing
, pyzmq
, zope_interface # for twisted
, itsdangerous # flask
, Babel # sphinx
, pytz
, speaklater # sagenb
, tornado
, imagesize
, requests
, gcc
, palp
, R
, giac
, polytopes_db
, combinatorial_designs
, alabaster
, three
, tachyon
, jmol
, elliptic_curves
, maxima-ecl
, cddlib
, glpk
, pari
, pari_data
, gmp
, sympow
, gfan
, sqlite
, python3
, python2
, rubiks
, snowballstemmer
, flint
}:
stdenv.mkDerivation rec {
version = "8.1"; # TODO
name = "sagedoc-${version}";
src = sage-src; # TODO
# TODO abstract sage deps
buildInputsWithoutPython = [
sagelib
pygments
ipython_5
traitlets
enum34
ipython_genutils
decorator
pexpect
ptyprocess
backports_shutil_get_terminal_size
pathlib2
pickleshare
prompt_toolkit
wcwidth
simplegeneric
openblasCompat
openblas-blas-pc
openblas-cblas-pc
openblas-lapack-pc
pkgconfig
psutil
future
singular
sympy
mpmath
fpylll
libgap
gap
matplotlib
scipy
pyparsing
cycler
networkx
dateutil
conway_polynomials
graphs
ecl
pillow
twisted
cvxopt
ipykernel
ipywidgets
rpy2
sphinx
sagenb
docutils
jupyter_client
flask
werkzeug
typing
pyzmq
zope_interface
itsdangerous # flask
Babel
flask-babel
flask-autoindex
flask-openid
flask-silk
pytz # babel
speaklater # babel
tornado # ipykernel
imagesize # sphinx
requests # sphinx
palp
R
giac
alabaster
flask-oldsessions
three
tachyon
jmol
cddlib
glpk
pari
gmp
sympow
gfan
sqlite
maxima-ecl
rubiks
snowballstemmer # needed for doc build
flint
];
buildInputs = buildInputsWithoutPython ++ [
(python3.withPackages (ps: with ps; buildInputsWithoutPython ))
# (python2.withPackages (ps: with ps; buildInputsWithoutPython ))
python2
];
autoreconfPhase = "true";
# environment variables for the build
SAGE_ROOT = sage-src;
SAGE_LOCAL = sage-src + "/src";
SAGE_SHARE = sagelib + "/share";
SAGE_DOC = (placeholder "out") + "/share/doc/sage";
SAGE_DOC_SRC = (placeholder "out") + "/docsrc";
SAGE_DOC_MATHJAX = "yes";
MAKE = "make";
SINGULARPATH="${singular}/share/singular";
SINGULAR_SO="${singular}/lib/libSingular.so";
SINGULAR_EXECUTABLE="${singular}/bin/Singular";
MAXIMA_FAS="${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas";
MAXIMA_PREFIX="${maxima-ecl}";
CONWAY_POLYNOMIALS_DATA_DIR="${conway_polynomials}/share/conway_polynomials";
GRAPHS_DATA_DIR="${graphs}/share/graphs";
ELLCURVE_DATA_DIR="${elliptic_curves}/share/ellcurves";
POLYTOPE_DATA_DIR="${polytopes_db}/share/reflexive_polytopes";
GAP_ROOT_DIR="${gap}/share/gap/build-dir";
COMBINATORIAL_DESIGN_DIR="${combinatorial_designs}/share";
ELLIPTIC_CURVES_DIR="${elliptic_curves}";
JMOL_DIR="${jmol}";
PARI_DATA_DIR="${pari_data}/share/pari";
ECLDIR="${ecl}/lib/ecl-${ecl.version}/";
unpackPhase = "true";
buildPhase = ''
export LD_LIBRARY_PATH="${flint}/lib"
export DYLD_LIBRARY_PATH="${flint}/lib" # FIXME
# needed for cython
export CC='${gcc}/bin/gcc'
export LDFLAGS='$NIX_TARGET_LDFLAGS -L${sagelib}/lib -L${sagelib}/lib -Wl,-rpath,${sagelib}/lib' # TODO sage paths neeed?
export CFLAGS='$NIX_CFLAGS_COMPILE'
export SITE_PACKAGES='${sagelib}/lib/python2.7/site-packages'
export SAGE_EXTCODE='${src}/src/ext'
mkdir -p "${SAGE_DOC}"
cp -r "${src}/src/doc" "${SAGE_DOC_SRC}"
chmod -R 755 "${SAGE_DOC_SRC}"
export SAGE_NUM_THREADS="$NIX_BUILD_CORES" # TODO unify environment vars
HOME="$TMP/sage_home" python -m "sage_setup.docbuild" all html
'';
installPhase = "true";
}