1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 fetchpatch,
6 cmake,
7 zlib,
8 potrace,
9 ffmpeg,
10 libarchive,
11 python3,
12 qtbase,
13 qttools,
14 wrapQtAppsHook,
15 testers,
16 qtsvg,
17 qtimageformats,
18 # For the tests
19 glaxnimate, # Call itself, for the tests
20 xvfb-run,
21}:
22let
23 # TODO: try to add a python library, see toPythonModule in doc/languages-frameworks/python.section.md
24 python3WithLibs = python3.withPackages (
25 ps: with ps; [
26 # In data/lib/python-lottie/requirements.txt
27 numpy
28 pillow
29 cairosvg
30 fonttools
31 grapheme
32 opencv4
33 pyqt5
34 qscintilla
35 # Not sure if needed, but appears in some files
36 pyyaml
37 requests
38 pybind11
39 ]
40 );
41in
42stdenv.mkDerivation rec {
43 pname = "glaxnimate";
44 version = "0.5.4";
45
46 src = fetchFromGitLab {
47 owner = "mattbas";
48 repo = "${pname}";
49 rev = version;
50 hash = "sha256-8oHJCQdP2xxSSDM0MDkSrG89WgCtMKm1AKlddnq3gig=";
51 fetchSubmodules = true;
52 };
53
54 patches = [
55 # Backport fix for newer ffmpeg
56 # FIXME: remove in next update
57 (fetchpatch {
58 url = "https://invent.kde.org/graphics/glaxnimate/-/commit/4fb2b67a0f0ce2fbffb6fe9f87c3bf7914c8a602.patch";
59 hash = "sha256-QjCnscGa7n+zwrImA4mbQiTQb9jmDGm8Y/7TK8jZXvM=";
60 })
61 ];
62
63 nativeBuildInputs = [
64 cmake
65 wrapQtAppsHook
66 qttools
67 ];
68
69 buildInputs = [
70 zlib
71 potrace
72 # Upstream asks for libav dependency, which is fulfilled by ffmpeg
73 ffmpeg
74 libarchive
75 qtbase
76 qttools
77 qtsvg
78 qtimageformats
79 python3WithLibs
80 ];
81
82 # Translation needs to be separately compiled
83 # https://gitlab.com/mattbas/glaxnimate/-/issues/648
84 buildFlags = [ "translations" ];
85
86 qtWrapperArgs = [ ''--prefix PATH : ${python3WithLibs}/bin'' ];
87
88 passthru.tests.version = lib.optionalAttrs stdenv.hostPlatform.isLinux (
89 testers.testVersion {
90 package = glaxnimate;
91 command = "${xvfb-run}/bin/xvfb-run glaxnimate --version";
92 }
93 );
94
95 meta = with lib; {
96 homepage = "https://gitlab.com/mattbas/glaxnimate";
97 description = "Simple vector animation program";
98 license = licenses.gpl3;
99 maintainers = with maintainers; [ tobiasBora ];
100 mainProgram = "glaxnimate";
101 };
102}