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