aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/data/fonts/twemoji-color-font/default.nix
blob: 23ae8e76b1d5b1b6849d9a4f1999b34b1952cc10 (plain)
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
{ stdenv, fetchFromGitHub, fetchpatch, inkscape, imagemagick, potrace, svgo, scfbuild }:

stdenv.mkDerivation rec {
  pname = "twemoji-color-font";
  version = "12.0.1";
  src = fetchFromGitHub {
    owner = "eosrei";
    repo = "twemoji-color-font";
    rev = "v${version}";
    sha256 = "00pbgqpkq21wl8fs0q1xp49xb10m48b9sz8cdc58flkd2vqfssw2";
  };

  patches = [
    # Fix build with Inkscape 1.0
    # https://github.com/eosrei/twemoji-color-font/pull/82
    (fetchpatch {
      url = "https://github.com/eosrei/twemoji-color-font/commit/208ad63c2ceb38c528b5237abeb2b85ceedc1d37.patch";
      sha256 = "TV8I++BEnVUQg7FNbnrEQ/MLV9n3drmspqjmDZgTGFI=";
      postFetch = ''
        substituteInPlace $out \
          --replace "inkscape --without-gui" "inkscape --export-png"
      '';
    })
  ];

  nativeBuildInputs = [ inkscape imagemagick potrace svgo scfbuild ];
  # silence inkscape errors about non-writable home
  preBuild = "export HOME=\"$NIX_BUILD_ROOT\"";
  makeFlags = [ "SCFBUILD=${scfbuild}/bin/scfbuild" ];
  enableParallelBuilding = true;

  installPhase = ''
    install -Dm755 build/TwitterColorEmoji-SVGinOT.ttf $out/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf
    install -Dm644 linux/fontconfig/56-twemoji-color.conf $out/etc/fonts/conf.d/56-twemoji-color.conf
  '';

  meta = with stdenv.lib; {
    description = "Color emoji SVGinOT font using Twitter Unicode 10 emoji with diversity and country flags";
    longDescription = ''
      A color and B&W emoji SVGinOT font built from the Twitter Emoji for
      Everyone artwork with support for ZWJ, skin tone diversity and country
      flags.

      The font works in all operating systems, but will currently only show
      color emoji in Firefox, Thunderbird, Photoshop CC 2017, and Windows Edge
      V38.14393+. This is not a limitation of the font, but of the operating
      systems and applications. Regular B&W outline emoji are included for
      backwards/fallback compatibility.
    '';
    homepage = "https://github.com/eosrei/twemoji-color-font";
    downloadPage = "https://github.com/eosrei/twemoji-color-font/releases";
    license = with licenses; [ cc-by-40 mit ];
    maintainers = [ maintainers.fgaz ];
  };
}