blob: 08f78b613efc764141885da5bb993b519dfc65c9 (
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
|
{ lib
, stdenvNoCC
, fetchurl
}:
# Metadata fetched from
# https://www.googleapis.com/webfonts/v1/webfonts?key=${GOOGLE_FONTS_TOKEN}&family=Noto+Emoji
let
metadata = with builtins; head (fromJSON (readFile ./noto-emoji.json)).items;
urlHashes = with builtins; fromJSON (readFile ./noto-emoji.hashes.json);
in
stdenvNoCC.mkDerivation {
pname = "noto-fonts-monochrome-emoji";
version = "${lib.removePrefix "v" metadata.version}.${metadata.lastModified}";
preferLocalBuild = true;
dontUnpack = true;
srcs =
let
weightNames = {
"300" = "Light";
regular = "Regular";
"500" = "Medium";
"600" = "SemiBold";
"700" = "Bold";
};
in
lib.mapAttrsToList
(variant: url: fetchurl {
name = "NotoEmoji-${weightNames.${variant}}.ttf";
hash = urlHashes.${url};
inherit url;
})
metadata.files;
installPhase = ''
runHook preInstall
for src in $srcs; do
install -D $src $out/share/fonts/noto/$(stripHash $src)
done
runHook postInstall
'';
meta = {
description = "Monochrome emoji font";
homepage = "https://fonts.google.com/noto/specimen/Noto+Emoji";
license = [ lib.licenses.ofl ];
maintainers = [ lib.maintainers.nicoo ];
platforms = lib.platforms.all;
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
};
}
|