diff --git a/pkgs/applications/video/manim/default.nix b/pkgs/applications/video/manim/default.nix new file mode 100644 index 000000000000..edc084ef6a0f --- /dev/null +++ b/pkgs/applications/video/manim/default.nix @@ -0,0 +1,134 @@ +{ lib +, fetchFromGitHub + +, cairo +, ffmpeg +, texlive + +, python3 +}: + +let + # According to ManimCommunity documentation manim uses tex-packages packaged + # in a custom distribution called "manim-latex", + # + # https://community.chocolatey.org/packages/manim-latex#files + # + # which includes another cutom distribution called tinytex, for which the + # package list can be found at + # + # https://github.com/yihui/tinytex/blob/master/tools/pkgs-custom.txt + # + # these two combined add up to: + manim-tinytex = { + inherit (texlive) + + # tinytex + scheme-infraonly amsfonts amsmath atbegshi atveryend auxhook babel bibtex + bigintcalc bitset booktabs cm dehyph dvipdfmx dvips ec epstopdf-pkg etex + etexcmds etoolbox euenc everyshi fancyvrb filehook firstaid float fontspec + framed geometry gettitlestring glyphlist graphics graphics-cfg graphics-def + grffile helvetic hycolor hyperref hyph-utf8 iftex inconsolata infwarerr + intcalc knuth-lib kvdefinekeys kvoptions kvsetkeys l3backend l3kernel + l3packages latex latex-amsmath-dev latex-bin latex-fonts latex-tools-dev + latexconfig latexmk letltxmacro lm lm-math ltxcmds lua-alt-getopt luahbtex + lualatex-math lualibs luaotfload luatex mdwtools metafont mfware natbib + pdfescape pdftex pdftexcmds plain psnfss refcount rerunfilecheck stringenc + tex tex-ini-files times tipa tools unicode-data unicode-math uniquecounter + url xcolor xetex xetexconfig xkeyval xunicode zapfding + + # manim-latex + standalone everysel preview doublestroke ms setspace rsfs relsize ragged2e + fundus-calligra microtype wasysym physics dvisvgm jknapltx wasy cm-super + babel-english gnu-freefont mathastext cbfonts-fd; + }; +in python3.pkgs.buildPythonApplication rec { + pname = "manim"; + format = "pyproject"; + version = "0.15.2"; + disabled = python3.pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "ManimCommunity"; + repo = pname; + rev = "v${version}"; + sha256 = "l5JiFWCMQbGnwRRtYzCHBXdVzWBrTNPdcIYaAt/wRNA="; + }; + + nativeBuildInputs = [ + python3.pkgs.poetry-core + ]; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace 'cloup = "^0.13.0"' 'cloup = "*"' \ + --replace 'mapbox-earcut = "^0.12.10"' 'mapbox-earcut = "*"' \ + ''; + + buildInputs = [ cairo ]; + + propagatedBuildInputs = with python3.pkgs; [ + click + click-default-group + cloup + colour + grpcio + grpcio-tools + importlib-metadata + isosurfaces + jupyterlab + manimpango + mapbox-earcut + moderngl + moderngl-window + networkx + numpy + pillow + pycairo + pydub + pygments + pysrt + rich + scipy + screeninfo + skia-pathops + srt + tqdm + watchdog + ]; + + makeWrapperArgs = [ + "--prefix" "PATH" ":" (lib.makeBinPath [ + ffmpeg + (texlive.combine manim-tinytex) + ]) + ]; + + + checkInputs = [ + python3.pkgs.pytest-cov + python3.pkgs.pytest-xdist + python3.pkgs.pytestCheckHook + + ffmpeg + (texlive.combine manim-tinytex) + ]; + + # about 55 of ~600 tests failing mostly due to demand for display + disabledTests = import ./failing_tests.nix; + + pythonImportsCheck = [ "manim" ]; + + meta = with lib; { + description = "Animation engine for explanatory math videos - Community version"; + longDescription = '' + Manim is an animation engine for explanatory math videos. It's used to + create precise animations programmatically, as seen in the videos of + 3Blue1Brown on YouTube. This is the community maintained version of + manim. + ''; + homepage = "https://github.com/ManimCommunity/manim"; + license = licenses.mit; + maintainers = with maintainers; [ friedelino ]; + }; +} diff --git a/pkgs/applications/video/manim/failing_tests.nix b/pkgs/applications/video/manim/failing_tests.nix new file mode 100644 index 000000000000..a1f82a98dc16 --- /dev/null +++ b/pkgs/applications/video/manim/failing_tests.nix @@ -0,0 +1,74 @@ +# reason for failure: tests try to open display +[ + "test_background_color" + "test_scene_add_remove" + "test_Circle" + "test_wait_skip" + "test_basic_scene_with_default_values" + "test_dry_run_with_png_format" + "test_dry_run_with_png_format_skipped_animations" + "test_FixedMobjects3D" + "test_basic_scene_l_flag" + "test_n_flag" + "test_s_flag_opengl_renderer" + "test_s_flag_no_animations" + "test_image_output_for_static_scene" + "test_no_image_output_with_interactive_embed" + "test_no_default_image_output_with_non_static_scene" + "test_image_output_for_static_scene_with_write_to_movie" + "test_s_flag" + "test_r_flag" + "test_play_skip" + "test_write_to_movie_disables_window" + "test_a_flag" + "test_pixel_coords_to_space_coords" + "test_t_values" + "test_custom_folders" + "test_t_values[15]" + "test_t_values[30]" + "test_t_values[60]" + "test_dash_as_filename" + "test_images_are_created_when_png_format_set_for_opengl" + "test_t_values_with_skip_animations" + "test_static_wait_detection" + "test_non_static_wait_detection" + "test_frozen_frame" + "test_gif_format_output" + "test_animate_with_changed_custom_attribute" + "test_images_are_zero_padded_when_zero_pad_set_for_opengl" + "test_mp4_format_output" + "test_videos_not_created_when_png_format_set" + "test_images_are_created_when_png_format_set" + "test_images_are_zero_padded_when_zero_pad_set" + "test_webm_format_output" + "test_default_format_output_for_transparent_flag" + "test_mov_can_be_set_as_output_format" + "test_force_window_opengl_render_with_format" + "test_get_frame_with_preview_disabled" + "test_get_frame_with_preview_enabled" +] ++ + +# reason for failure: tests try to reach network +[ + "test_logging_to_file" + "test_plugin_function_like" + "test_plugin_no_all" + "test_plugin_with_all" +] ++ + +# failing with: +# E AssertionError: +# E Not equal to tolerance rtol=1e-07, atol=1.01 +# E Frame no -1. You can use --show_diff to visually show the difference. +# E Mismatched elements: 18525 / 1639680 (1.13%) +# E Max absolute difference: 255 +# E Max relative difference: 255. +[ + "test_Text2Color" +] ++ + +# failing with: +# TypeError: __init__() got an unexpected keyword argument 'msg' - maybe you meant pytest.mark.skipif? +[ + "test_force_window_opengl_render_with_movies" +] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index be21b37ac762..2edcae1efbb0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26739,6 +26739,8 @@ with pkgs; m32edit = callPackage ../applications/audio/midas/m32edit.nix {}; + manim = callPackage ../applications/video/manim { }; + manuskript = libsForQt5.callPackage ../applications/editors/manuskript { }; manul = callPackage ../development/tools/manul { };