twemoji-color-font: use prebuilt from release

Building from sources takes 1.5 hours on hydra for minimal advantages.
Relevant discussion:
https://github.com/NixOS/nixpkgs/issues/97871
This commit is contained in:
Francesco Gazzetta 2021-01-20 17:28:05 +01:00 committed by Milan
parent d35eb344f8
commit 0c5984cf83
2 changed files with 14 additions and 29 deletions

View File

@ -1,37 +1,24 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, inkscape, imagemagick, potrace, svgo, scfbuild }:
{ lib
, stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "twemoji-color-font";
version = "12.0.1";
src = fetchFromGitHub {
owner = "eosrei";
repo = "twemoji-color-font";
rev = "v${version}";
sha256 = "00pbgqpkq21wl8fs0q1xp49xb10m48b9sz8cdc58flkd2vqfssw2";
# We fetch the prebuilt font because building it takes 1.5 hours on hydra.
# Relevant issue: https://github.com/NixOS/nixpkgs/issues/97871
src = fetchurl {
url = "https://github.com/eosrei/twemoji-color-font/releases/download/v${version}/TwitterColorEmoji-SVGinOT-Linux-${version}.tar.gz";
sha256 = "1kdy2k7b1k7sjp2l8g10lp2v000iwk8i3wcwgkhqfbwrrj7dg1kq";
};
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;
dontBuild = 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
install -Dm755 TwitterColorEmoji-SVGinOT.ttf $out/share/fonts/truetype/TwitterColorEmoji-SVGinOT.ttf
install -Dm644 fontconfig/56-twemoji-color.conf $out/etc/fonts/conf.d/56-twemoji-color.conf
'';
meta = with lib; {

View File

@ -20899,9 +20899,7 @@ in
ttf-tw-moe = callPackage ../data/fonts/ttf-tw-moe { };
twemoji-color-font = callPackage ../data/fonts/twemoji-color-font {
inherit (nodePackages) svgo;
};
twemoji-color-font = callPackage ../data/fonts/twemoji-color-font { };
twitter-color-emoji = callPackage ../data/fonts/twitter-color-emoji { };