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