1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 poetry-core,
6 pytest-xdist,
7 pytestCheckHook,
8 pythonOlder,
9 pythonRelaxDepsHook,
10
11 cairo,
12 ffmpeg,
13 texliveInfraOnly,
14
15 click,
16 click-default-group,
17 cloup,
18 colour,
19 grpcio,
20 grpcio-tools,
21 importlib-metadata,
22 isosurfaces,
23 jupyterlab,
24 manimpango,
25 mapbox-earcut,
26 moderngl,
27 moderngl-window,
28 networkx,
29 numpy,
30 pillow,
31 pycairo,
32 pydub,
33 pygments,
34 rich,
35 scipy,
36 screeninfo,
37 skia-pathops,
38 srt,
39 svgelements,
40 tqdm,
41 watchdog,
42}:
43
44let
45 # According to ManimCommunity documentation manim uses tex-packages packaged
46 # in a custom distribution called "manim-latex",
47 #
48 # https://community.chocolatey.org/packages/manim-latex#files
49 #
50 # which includes another cutom distribution called tinytex, for which the
51 # package list can be found at
52 #
53 # https://github.com/yihui/tinytex/blob/master/tools/pkgs-custom.txt
54 #
55 # these two combined add up to:
56 manim-tinytex = texliveInfraOnly.withPackages (
57 ps: with ps; [
58
59 # tinytex
60 amsfonts
61 amsmath
62 atbegshi
63 atveryend
64 auxhook
65 babel
66 bibtex
67 bigintcalc
68 bitset
69 booktabs
70 cm
71 dehyph
72 dvipdfmx
73 dvips
74 ec
75 epstopdf-pkg
76 etex
77 etexcmds
78 etoolbox
79 euenc
80 everyshi
81 fancyvrb
82 filehook
83 firstaid
84 float
85 fontspec
86 framed
87 geometry
88 gettitlestring
89 glyphlist
90 graphics
91 graphics-cfg
92 graphics-def
93 grffile
94 helvetic
95 hycolor
96 hyperref
97 hyph-utf8
98 iftex
99 inconsolata
100 infwarerr
101 intcalc
102 knuth-lib
103 kvdefinekeys
104 kvoptions
105 kvsetkeys
106 l3backend
107 l3kernel
108 l3packages
109 latex
110 latex-amsmath-dev
111 latex-bin
112 latex-fonts
113 latex-tools-dev
114 latexconfig
115 latexmk
116 letltxmacro
117 lm
118 lm-math
119 ltxcmds
120 lua-alt-getopt
121 luahbtex
122 lualatex-math
123 lualibs
124 luaotfload
125 luatex
126 mdwtools
127 metafont
128 mfware
129 natbib
130 pdfescape
131 pdftex
132 pdftexcmds
133 plain
134 psnfss
135 refcount
136 rerunfilecheck
137 stringenc
138 tex
139 tex-ini-files
140 times
141 tipa
142 tools
143 unicode-data
144 unicode-math
145 uniquecounter
146 url
147 xcolor
148 xetex
149 xetexconfig
150 xkeyval
151 xunicode
152 zapfding
153
154 # manim-latex
155 standalone
156 everysel
157 preview
158 doublestroke
159 ms
160 setspace
161 rsfs
162 relsize
163 ragged2e
164 fundus-calligra
165 microtype
166 wasysym
167 physics
168 dvisvgm
169 jknapltx
170 wasy
171 cm-super
172 babel-english
173 gnu-freefont
174 mathastext
175 cbfonts-fd
176 ]
177 );
178in
179buildPythonPackage rec {
180 pname = "manim";
181 pyproject = true;
182 version = "0.18.1";
183 disabled = pythonOlder "3.9";
184
185 src = fetchFromGitHub {
186 owner = "ManimCommunity";
187 repo = "manim";
188 rev = "refs/tags/v${version}";
189 hash = "sha256-o+Wl3NMK6yopcsRVFtZuUE9c1GABa5d8rbQNHDJ4OiQ=";
190 };
191
192 nativeBuildInputs = [
193 poetry-core
194 pythonRelaxDepsHook
195 ];
196
197 pythonRelaxDeps = [
198 "cloup"
199 "isosurfaces"
200 "pillow"
201 "skia-pathops"
202 "watchdog"
203 ];
204
205 patches = [ ./pytest-report-header.patch ];
206
207 postPatch = ''
208 substituteInPlace pyproject.toml \
209 --replace "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term" ""
210 '';
211
212 buildInputs = [ cairo ];
213
214 propagatedBuildInputs = [
215 click
216 click-default-group
217 cloup
218 colour
219 grpcio
220 grpcio-tools
221 importlib-metadata
222 isosurfaces
223 jupyterlab
224 manimpango
225 mapbox-earcut
226 moderngl
227 moderngl-window
228 networkx
229 numpy
230 pillow
231 pycairo
232 pydub
233 pygments
234 rich
235 scipy
236 screeninfo
237 skia-pathops
238 srt
239 svgelements
240 tqdm
241 watchdog
242 ];
243
244 makeWrapperArgs = [
245 "--prefix"
246 "PATH"
247 ":"
248 (lib.makeBinPath [
249 ffmpeg
250 manim-tinytex
251 ])
252 ];
253
254 nativeCheckInputs = [
255 ffmpeg
256 manim-tinytex
257 pytest-xdist
258 pytestCheckHook
259 ];
260
261 # about 55 of ~600 tests failing mostly due to demand for display
262 disabledTests = import ./failing_tests.nix;
263
264 pythonImportsCheck = [ "manim" ];
265
266 meta = with lib; {
267 description = "Animation engine for explanatory math videos - Community version";
268 longDescription = ''
269 Manim is an animation engine for explanatory math videos. It's used to
270 create precise animations programmatically, as seen in the videos of
271 3Blue1Brown on YouTube. This is the community maintained version of
272 manim.
273 '';
274 homepage = "https://github.com/ManimCommunity/manim";
275 license = licenses.mit;
276 maintainers = with maintainers; [ friedelino ];
277 };
278}