From 4db381faddee6e951aa76d5a64073d22fe23f314 Mon Sep 17 00:00:00 2001 From: Naoki Pross Date: Wed, 20 Oct 2021 00:56:43 +0200 Subject: Prepare nix env for video --- video/manimgl/default.nix | 30 ++++++++++++++++++++++++++++++ video/manimgl/mapbox-earcut.nix | 25 +++++++++++++++++++++++++ video/manimpango/default.nix | 22 ++++++++++++++++++++++ video/qam.py | 14 ++++++++++++++ video/shell.nix | 27 +++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 video/manimgl/default.nix create mode 100644 video/manimgl/mapbox-earcut.nix create mode 100644 video/manimpango/default.nix create mode 100644 video/qam.py create mode 100644 video/shell.nix (limited to 'video') diff --git a/video/manimgl/default.nix b/video/manimgl/default.nix new file mode 100644 index 0000000..cdab07e --- /dev/null +++ b/video/manimgl/default.nix @@ -0,0 +1,30 @@ +{ lib, pkgs, buildPythonApplication, buildPythonPackage, fetchPypi, pythonOlder, + manimpango, mapbox-earcut }: + +buildPythonApplication rec { + pname = "manimgl"; + version = "1.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "1bsrn72vjzfz3ldh3cjn9r2gxr18408ja2shz50qwh7jnwi8alyb"; + }; + + preConfigure = '' + sed -i '/argparse/d' manimgl.egg-info/requires.txt + sed -i '/argparse/d' setup.cfg + ''; + + doCheck = false; + + propagatedBuildInputs = [ manimpango mapbox-earcut ] ++ (with pkgs; [ + texlive.combined.scheme-full ffmpeg + ]) ++ (with pkgs.python3Packages; [ + cython sympy numpy pydub scipy pyyaml pyopengl pyopengl-accelerate moderngl moderngl-window + matplotlib colour rich screeninfo tqdm validators + ]); + + disabled = pythonOlder "3.7"; + + meta = { }; +} diff --git a/video/manimgl/mapbox-earcut.nix b/video/manimgl/mapbox-earcut.nix new file mode 100644 index 0000000..d325401 --- /dev/null +++ b/video/manimgl/mapbox-earcut.nix @@ -0,0 +1,25 @@ +{ lib, pkgs, buildPythonPackage, fetchPypi }: + +buildPythonPackage rec { + pname = "mapbox_earcut"; + version = "0.12.10"; + src = fetchPypi { + inherit pname version; + format = "setuptools"; + sha256 = "0ly48lijgd9inq07x42pfp9c24fn16vn9axpmfwqrkn979krbnah"; + }; + + dontUseCmakeConfigure = true; + + nativeBuildInputs = with pkgs; [ cmake ]; + + buildInputs = with pkgs.python3Packages; [ + setuptools_scm pybind11 + ]; + + propagatedBuildInputs = with pkgs.python3Packages; [ + numpy + ]; + + meta = with lib; {}; +} diff --git a/video/manimpango/default.nix b/video/manimpango/default.nix new file mode 100644 index 0000000..97b5e97 --- /dev/null +++ b/video/manimpango/default.nix @@ -0,0 +1,22 @@ +{ lib, pkgs, buildPythonPackage, fetchPypi }: + +buildPythonPackage rec { + pname = "ManimPango"; + version = "0.3.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "09fc7zv953ni7pilv869ldbjgz59j41a8vbz637rqzjh2yjfb9x3"; + }; + + nativeBuildInputs = with pkgs; [ + gcc pkgconfig + ]; + + propagatedBuildInputs = with pkgs; [ pango ] + ++ (with pkgs.python3Packages; [ + cython pytest numpy pillow + ]); + + meta = with lib; {}; +} diff --git a/video/qam.py b/video/qam.py new file mode 100644 index 0000000..917fdeb --- /dev/null +++ b/video/qam.py @@ -0,0 +1,14 @@ +from manimlib import * + +class QamModulation(Scene): + CONFIG = { + "camera_class": ThreeDCamera, + } + + def construct(self): + circle = Circle() + self.play(FadeIn(circle)) + self.wait(3) + + # open an interactive IPython shell here + self.embed() diff --git a/video/shell.nix b/video/shell.nix new file mode 100644 index 0000000..bdb2575 --- /dev/null +++ b/video/shell.nix @@ -0,0 +1,27 @@ +with import {}; +let + manimpango = callPackage manimpango/default.nix { + buildPythonPackage = pkgs.python3Packages.buildPythonPackage; + fetchPypi = pkgs.python3Packages.fetchPypi; + }; + + mapbox-earcut = callPackage manimgl/mapbox-earcut.nix { + buildPythonPackage = pkgs.python3Packages.buildPythonPackage; + fetchPypi = pkgs.python3Packages.fetchPypi; + }; + + manimgl = callPackage manimgl/default.nix { + buildPythonApplication = pkgs.python3Packages.buildPythonApplication; + buildPythonPackage = pkgs.python3Packages.buildPythonPackage; + fetchPypi = pkgs.python3Packages.fetchPypi; + pythonOlder = pkgs.python3Packages.pythonOlder; + manimpango = manimpango; + mapbox-earcut = mapbox-earcut; + }; + +in mkShell { + buildInputs = [ manimpango manimgl ]; + shellHook = '' + manimgl qam.py + ''; +} -- cgit v1.2.1