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 rec {
189 pname = "manim";
190 pyproject = true;
191 version = "0.19.2";
192
193 src = fetchFromGitHub {
194 owner = "ManimCommunity";
195 repo = "manim";
196 tag = "v${version}";
197 hash = "sha256-sM2IQdrqWVopo5Yzjmv6/KTHkgb/7Fma+plAc+gGwaM=";
198 };
199
200 build-system = [
201 hatchling
202 ];
203
204 patches = [ ./pytest-report-header.patch ];
205
206 buildInputs = [ cairo ];
207
208 dependencies = [
209 av
210 beautifulsoup4
211 click
212 cloup
213 decorator
214 isosurfaces
215 manimpango
216 mapbox-earcut
217 moderngl
218 moderngl-window
219 networkx
220 numpy
221 pillow
222 pycairo
223 pydub
224 pygments
225 rich
226 scipy
227 screeninfo
228 skia-pathops
229 srt
230 svgelements
231 tqdm
232 typing-extensions
233 watchdog
234 ]
235 ++ lib.optionals (pythonAtLeast "3.13") [
236 audioop-lts
237 ];
238
239 optional-dependencies = {
240 jupyterlab = [
241 jupyterlab
242 notebook
243 ];
244 # TODO package dearpygui
245 # gui = [ dearpygui ];
246 };
247
248 makeWrapperArgs = [
249 "--prefix"
250 "PATH"
251 ":"
252 (lib.makeBinPath [
253 ffmpeg
254 manim-tinytex
255 ])
256 ];
257
258 nativeCheckInputs = [
259 ffmpeg
260 manim-tinytex
261 pytest-cov-stub
262 pytest-xdist
263 pytestCheckHook
264 versionCheckHook
265 ];
266
267 # about 55 of ~600 tests failing mostly due to demand for display
268 disabledTests = import ./failing_tests.nix;
269
270 pythonImportsCheck = [ "manim" ];
271
272 meta = {
273 # https://github.com/ManimCommunity/manim/pull/4037
274 broken = lib.versionAtLeast av.version "14";
275 description = "Animation engine for explanatory math videos - Community version";
276 longDescription = ''
277 Manim is an animation engine for explanatory math videos. It's used to
278 create precise animations programmatically, as seen in the videos of
279 3Blue1Brown on YouTube. This is the community maintained version of
280 manim.
281 '';
282 mainProgram = "manim";
283 changelog = "https://github.com/ManimCommunity/manim/releases/tag/${src.tag}";
284 homepage = "https://github.com/ManimCommunity/manim";
285 license = lib.licenses.mit;
286 maintainers = with lib.maintainers; [ osbm ];
287 };
288}