about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/no/noto-fonts-color-emoji/package.nix
blob: 37f56db62df192f0da36262727606a0c4bb42eb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ lib
, stdenvNoCC
, fetchFromGitHub
, buildPackages
, pkg-config
, cairo
, imagemagick
, zopfli
, pngquant
, which
}:

let
  emojiPythonEnv =
    buildPackages.python3.withPackages (p: with p; [ fonttools nototools ]);
in
stdenvNoCC.mkDerivation rec {
  pname = "noto-fonts-color-emoji";
  version = "2.042";

  src = fetchFromGitHub {
    owner = "googlefonts";
    repo = "noto-emoji";
    rev = "v${version}";
    hash = "sha256-otJQMXrBIPrxD1vCdgcrZ2h1a9XAMbqEBFumjz1XJ54=";
  };

  depsBuildBuild = [
    buildPackages.stdenv.cc
    pkg-config
    cairo
  ];

  nativeBuildInputs = [
    imagemagick
    zopfli
    pngquant
    which
    emojiPythonEnv
  ];

  postPatch = ''
    patchShebangs *.py
    patchShebangs third_party/color_emoji/*.py
    # remove check for virtualenv, since we handle
    # python requirements using python.withPackages
    sed -i '/ifndef VIRTUAL_ENV/,+2d' Makefile
    # Make the build verbose so it won't get culled by Hydra thinking that
    # it somehow got stuck doing nothing.
    sed -i 's;\t@;\t;' Makefile
  '';

  enableParallelBuilding = true;

  installPhase = ''
    runHook preInstall
    mkdir -p $out/share/fonts/noto
    cp NotoColorEmoji.ttf $out/share/fonts/noto
    runHook postInstall
  '';

  meta = {
    description = "Color emoji font";
    homepage = "https://github.com/googlefonts/noto-emoji";
    license = with lib.licenses; [ ofl asl20 ];
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ mathnerd314 sternenseemann ];
  };
}