nixpkgs/pkgs/tools/misc/nanoemoji/default.nix
Theodore Ni a586a9e55f
python3.pkgs.ninja: rename from ninja-python
I am hoping this can be a transparent shim for most if not all Python
packages that acts as a proxy to the actual ninja package in nixpkgs.
If this works, doing it this way simplifies rolling out the new Python
build hooks that do stricter build dependency validation.
2023-08-03 21:38:47 -07:00

73 lines
1.5 KiB
Nix

{ 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
picosvg
pillow
regex
toml
tomlkit
ufo2ft
ufoLib2
zopfli
];
nativeCheckInputs = with python3.pkgs; [
pytestCheckHook
ninja
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 ];
};
}