1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5}:
6let
7 fonts = {
8 assamese = {
9 label = "Assamese";
10 version = "2.91.5";
11 hash = "sha256-Oo/hHHFg/Nu3eaZLMdBclY90lKU2AMFUclyXHxGaAgg=";
12 };
13 bengali = {
14 label = "Bengali";
15 version = "2.91.5";
16 hash = "sha256-QGf94TdQS2c9+wSSDK4Mknw5ubCGTuvg0xoNaJdirBc=";
17 };
18 devanagari = {
19 label = "Devanagari script";
20 version = "2.95.4";
21 hash = "sha256-6CbOCqOei5eO1zwNQZvB+fFDkqxvJnK82z+zmClhRAE=";
22 };
23 gujarati = {
24 label = "Gujarati";
25 version = "2.92.4";
26 hash = "sha256-BpwibF0/HXDvXpDEek0fj73cxo2QC1hSfQ49Q/ZOZg8=";
27 };
28 gurmukhi = {
29 label = "Gurmukhi script";
30 version = "2.91.2";
31 hash = "sha256-5iLFW2FEE5LBqoALi+3sUjwC0ADntsp259TP+bYwR9g=";
32 }; # renamed from Punjabi
33 kannada = {
34 label = "Kannada";
35 version = "2.5.4";
36 hash = "sha256-7y2u0tBdNYCeY7Y+aqhxXP7Qv6GglJeVO1wvM9CzyIQ=";
37 };
38 malayalam = {
39 label = "Malayalam";
40 version = "2.92.2";
41 hash = "sha256-SzM38vuAlP9OMC8kUuHQylmH8TUjCeg1y/Zcu2I2bjA=";
42 };
43 marathi = {
44 label = "Marathi";
45 version = "2.94.2";
46 hash = "sha256-jK1Gwcr5gqzRNkbIxs4V/OYgUlUEpU0OYzKDTkiMlqM=";
47 };
48 nepali = {
49 label = "Nepali";
50 version = "2.94.2";
51 hash = "sha256-OX1ekxeSbVGOrdbZ3Jvu4nii0zkgbuij10JIzqRcFx4=";
52 };
53 odia = {
54 label = "Odia";
55 version = "2.91.2";
56 hash = "sha256-3/eczBGGZj4QPs7KY0as9zk5HaBfhgz6YgU0qmwpVcA=";
57 }; # renamed from Oriya
58 tamil-classical = {
59 label = "Classical Tamil";
60 version = "2.5.4";
61 hash = "sha256-6SsddTCEUHMoF7X4+i7eXimmMuktfFAl8uz95RwM+yg=";
62 };
63 tamil = {
64 label = "Tamil";
65 version = "2.91.3";
66 hash = "sha256-8lcNw87o9lhQsKwCqwBSfx7rhcrH/eEqac7EsA9/w/E=";
67 };
68 telugu = {
69 label = "Telugu";
70 version = "2.5.5";
71 hash = "sha256-cZh93NfEB+5S1JeEowtBMJ0nbZsFGpbEp2WAtzxrA8A=";
72 };
73 };
74 gplfonts = {
75 # GPL fonts removed from later releases
76 kashmiri = {
77 label = "Kashmiri";
78 version = "2.4.3";
79 hash = "sha256-6T2QaWnt3+e5nr4vbk44FouqmeWKzia1lSf8S/bvqCs=";
80 };
81 konkani = {
82 label = "Konkani";
83 version = "2.4.3";
84 hash = "sha256-hVy2rxrUTPDeNnugi3Bk7z0JqGmk4/yeUsAoI/4R7A8=";
85 };
86 maithili = {
87 label = "Maithili";
88 version = "2.4.3";
89 hash = "sha256-ikDcpJqdizAYRpgoebzqxOEeodJ6C3fO2rsqGzC0HCs=";
90 };
91 sindhi = {
92 label = "Sindhi";
93 version = "2.4.3";
94 hash = "sha256-wU3B9fh+8E1bFBMnakzmajY7eNKzed9+eYL5AOxyNQI=";
95 };
96 };
97
98 mkpkg =
99 license: pname:
100 {
101 label,
102 version,
103 hash,
104 }:
105 stdenvNoCC.mkDerivation {
106 inherit pname version;
107
108 src = fetchurl {
109 url = "https://releases.pagure.org/lohit/lohit-${pname}-ttf-${version}.tar.gz";
110 inherit hash;
111 };
112
113 installPhase = ''
114 runHook preInstall
115
116 mkdir -p $out/share/fonts/truetype
117 cp -v *.ttf $out/share/fonts/truetype/
118
119 mkdir -p $out/etc/fonts/conf.d
120 cp -v *.conf $out/etc/fonts/conf.d
121
122 mkdir -p "$out/share/doc/lohit-${pname}"
123 cp -v ChangeLog* COPYRIGHT* "$out/share/doc/lohit-${pname}/"
124
125 runHook postInstall
126 '';
127
128 meta = {
129 inherit license;
130 description = "Free and open source fonts for Indian languages (" + label + ")";
131 homepage = "https://pagure.io/lohit";
132 maintainers = [
133 lib.maintainers.mathnerd314
134 lib.maintainers.ttuegel
135 ];
136 # Set a non-zero priority to allow easy overriding of the
137 # fontconfig configuration files.
138 priority = 5;
139 };
140 };
141
142in
143# Technically, GPLv2 with usage exceptions
144lib.mapAttrs (mkpkg lib.licenses.gpl2) gplfonts // lib.mapAttrs (mkpkg lib.licenses.ofl) fonts