1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pytestCheckHook,
6 setuptools,
7 setuptools-scm,
8 resvg,
9 pngquant,
10 absl-py,
11 fonttools,
12 lxml,
13 ninja,
14 picosvg,
15 pillow,
16 regex,
17 toml,
18 tomlkit,
19 ufo2ft,
20 ufolib2,
21 zopfli,
22}:
23
24buildPythonPackage rec {
25 pname = "nanoemoji";
26 version = "0.15.9";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "googlefonts";
31 repo = "nanoemoji";
32 tag = "v${version}";
33 hash = "sha256-T/d7gbw8n2I6amp3qAK/uo3Uf1qZ9teVOCIgkiMSkmE=";
34 };
35
36 patches = [
37 # this is necessary because the tests clear PATH/PYTHONPATH otherwise
38 ./test-pythonpath.patch
39 ];
40
41 build-system = [
42 setuptools
43 setuptools-scm
44 ];
45
46 nativeBuildInputs = [
47 pngquant
48 resvg
49 ];
50
51 # these two packages are just prebuilt wheels containing the respective binaries
52 pythonRemoveDeps = [
53 "pngquant-cli"
54 "resvg-cli"
55 ];
56
57 dependencies = [
58 absl-py
59 fonttools
60 lxml
61 ninja
62 picosvg
63 pillow
64 regex
65 toml
66 tomlkit
67 ufo2ft
68 ufolib2
69 zopfli
70 ];
71
72 nativeCheckInputs = [
73 pytestCheckHook
74 ninja
75 picosvg
76 ];
77
78 makeWrapperArgs = [
79 "--prefix PATH : ${
80 lib.makeBinPath [
81 pngquant
82 resvg
83 ]
84 }"
85 ];
86
87 preCheck = ''
88 # make sure the built binaries (nanoemoji/maximum_color) can be found by the test
89 export PATH="$out/bin:$PATH"
90 '';
91
92 meta = {
93 description = "Wee tool to build color fonts";
94 homepage = "https://github.com/googlefonts/nanoemoji";
95 changelog = "https://github.com/googlefonts/nanoemoji/releases/tag/${src.tag}";
96 license = lib.licenses.asl20;
97 maintainers = with lib.maintainers; [ _999eagle ];
98 };
99}