summary refs log tree commit diff
path: root/pkgs/tools/misc/nanoemoji/default.nix
diff options
context:
space:
mode:
authorSophie Tauchert <sophie@999eagle.moe>2023-07-17 21:17:41 +0200
committerSophie Tauchert <sophie.tauchert@relaxdays.de>2023-07-21 10:28:40 +0200
commit1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432 (patch)
tree35684557907c0aea08b0a44d75ba72cff9267051 /pkgs/tools/misc/nanoemoji/default.nix
parentaaef56b7baeea7b80941fd2d65895f0e84eb36d3 (diff)
downloadnixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar.gz
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar.bz2
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar.lz
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar.xz
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.tar.zst
nixpkgs-1ce92c15f2cc96e02b3b43ee3b2cd8ff86f68432.zip
nanoemoji: init at 0.15.1
Diffstat (limited to 'pkgs/tools/misc/nanoemoji/default.nix')
-rw-r--r--pkgs/tools/misc/nanoemoji/default.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/tools/misc/nanoemoji/default.nix b/pkgs/tools/misc/nanoemoji/default.nix
new file mode 100644
index 00000000000..0e584bc978a
--- /dev/null
+++ b/pkgs/tools/misc/nanoemoji/default.nix
@@ -0,0 +1,72 @@
+{ lib
+, python3
+, fetchFromGitHub
+, resvg
+, pngquant
+}:
+python3.pkgs.buildPythonApplication rec {
+  pname = "nanoemoji";
+  version = "0.15.1";
+
+  src = fetchFromGitHub {
+    owner = "googlefonts";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-P/lT0PnjTdYzyttICzszu4OL5kj+X8GHZ8doL3tpXQM=";
+  };
+  patches = [
+    # this is necessary because the tests clear PATH/PYTHONPATH otherwise
+    ./test-pythonpath.patch
+    # minor difference in the test output, most likely due to different dependency versions
+    ./fix-test.patch
+  ];
+
+  nativeBuildInputs = with python3.pkgs; [
+    setuptools-scm
+    pythonRelaxDepsHook
+
+    pngquant
+    resvg
+  ];
+
+  # these two packages are just prebuilt wheels containing the respective binaries
+  pythonRemoveDeps = [ "pngquant-cli" "resvg-cli" ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    absl-py
+    fonttools
+    lxml
+    ninja-python
+    picosvg
+    pillow
+    regex
+    toml
+    tomlkit
+    ufo2ft
+    ufoLib2
+    zopfli
+  ];
+
+  nativeCheckInputs = with python3.pkgs; [
+    pytestCheckHook
+
+    ninja-python
+    picosvg
+  ];
+
+  makeWrapperArgs = [
+    "--prefix PATH : ${lib.makeBinPath [ pngquant resvg ]}"
+  ];
+
+  preCheck = ''
+    # make sure the built binaries (nanoemoji/maximum_color) can be found by the test
+    export PATH="$out/bin:''${PATH}"
+  '';
+
+  meta = with lib; {
+    description = "A wee tool to build color fonts";
+    homepage = "https://github.com/googlefonts/nanoemoji";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ _999eagle ];
+  };
+}