@@ -0,0 +1,64 @@
1+{ lib, buildPythonApplication, fetchFromGitHub, pythonOlder, file, fetchpatch
2+, cairo, ffmpeg, sox, xdg_utils, texlive
3+, colour, numpy, pillow, progressbar, scipy, tqdm, opencv , pycairo, pydub
4+, pbr, fetchPypi
5+}:
6+buildPythonApplication rec {
7+ pname = "manim";
8+ version = "0.1.10";
9+
10+ src = fetchPypi {
11+ pname = "manimlib";
12+ inherit version;
13+ sha256 = "0vg9b3rwypq5zir74pi0pmj47yqlcg7hrvscwrpjzjbqq2yihn49";
14+ };
15+
16+ patches = [ ./remove-dependency-constraints.patch ];
17+
18+ nativeBuildInputs = [ pbr ];
19+
20+ propagatedBuildInputs = [
21+ colour
22+ numpy
23+ pillow
24+ progressbar
25+ scipy
26+ tqdm
27+ opencv
28+ pycairo
29+ pydub
30+
31+ cairo sox ffmpeg xdg_utils
32+ ];
33+
34+ # Test with texlive to see whether it works but don't propagate
35+ # because it's huge and optional
36+ # TODO: Use smaller TexLive distribution
37+ # Doesn't need everything but it's hard to figure out what it needs
38+ checkInputs = [ cairo sox ffmpeg xdg_utils texlive.combined.scheme-full ];
39+
40+ # Simple test and complex test with LaTeX
41+ checkPhase = ''
42+ for scene in SquareToCircle OpeningManimExample
43+ do
44+ python3 manim.py example_scenes.py $scene -l
45+ tail -n 20 files/Tex/*.log # Print potential LaTeX erorrs
46+ ${file}/bin/file videos/example_scenes/480p15/$scene.mp4 \
47+ | tee | grep -F "ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]"
48+ done
49+ '';
50+
51+ disabled = pythonOlder "3.7";
52+
53+ meta = {
54+ description = "Animation engine for explanatory math videos";
55+ longDescription = ''
56+ Manim is an animation engine for explanatory math videos. It's used to
57+ create precise animations programmatically, as seen in the videos of
58+ 3Blue1Brown on YouTube.
59+ '';
60+ homepage = https://github.com/3b1b/manim;
61+ license = lib.licenses.mit;
62+ maintainers = with lib.maintainers; [ johnazoidberg ];
63+ };
64+}