nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# hyphen dictionaries
2
3{
4 hyphen,
5 stdenv,
6 lib,
7 fetchgit,
8 fetchurl,
9 symlinkJoin,
10}:
11
12let
13 libreofficeRepository = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git";
14 libreofficeCommit = "9e27d044d98e65f89af8c86df722a77be827bdc8";
15 libreofficeSubdir = "de";
16
17 # this does not assume any structure for dictFilePath and readmeFilePath
18 mkDictFromLibreofficeGitCustom =
19 {
20 subdir,
21 shortName,
22 shortDescription,
23 dictFilePath,
24 readmeFilePath ? "",
25 }:
26 stdenv.mkDerivation rec {
27 version = "24.8";
28 pname = "hyphen-dict-${shortName}-libreoffice";
29 src = fetchgit {
30 url = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git";
31 rev = "a2bf59878dd76685803ec260e15d875746ad6e25";
32 hash = "sha256-3CvjgNjsrm4obATK6LmtYob8i2ngTbwP6FB4HlJMPCE=";
33 };
34 meta = {
35 description = "Hyphen dictionary for ${shortDescription} from LibreOffice";
36 homepage = "https://wiki.documentfoundation.org/Development/Dictionaries";
37 license = with lib.licenses; [ mpl20 ];
38 maintainers = with lib.maintainers; [ theCapypara ];
39 platforms = lib.platforms.all;
40 };
41 dontBuild = true;
42 installPhase = ''
43 runHook preInstall
44 cd $src/${subdir}
45 install -dm755 "$out/share/hyphen"
46 install -m644 "${dictFilePath}" "$out/share/hyphen"
47 # docs
48 if [ -n "${readmeFilePath}" ]; then
49 install -dm755 "$out/share/doc/"
50 install -m644 "${readmeFilePath}" "$out/share/doc/${pname}.txt"
51 fi
52 runHook postInstall
53 '';
54 };
55
56 # wrapper for backwards compatibility
57 mkDictFromLibreofficeGit =
58 {
59 subdir,
60 shortName,
61 shortDescription,
62 dictFileName,
63 readmeFileName ? "",
64 }:
65 mkDictFromLibreofficeGitCustom {
66 inherit subdir;
67 inherit shortName;
68 inherit shortDescription;
69 dictFilePath = "hyph_${dictFileName}.dic";
70 readmeFilePath = if (readmeFileName != "") then "README_${readmeFileName}.txt" else "";
71 };
72
73 dicts = rec {
74
75 # see https://wiki.documentfoundation.org/Development/Dictionaries
76 # for a list of available hyphenation dictionaries
77
78 # see https://github.com/LibreOffice/dictionaries
79 # for the sources and to find the names of the README files
80
81 # AFRIKAANS
82
83 af_ZA = af-za;
84 af-za = mkDictFromLibreofficeGit {
85 subdir = "af_ZA";
86 shortName = "af-za";
87 shortDescription = "Afrikaans";
88 dictFileName = "af_ZA";
89 readmeFileName = "af_ZA";
90 };
91
92 # BELARUSSIAN
93
94 be_BY = be-by;
95 be-by = mkDictFromLibreofficeGit {
96 subdir = "be_BY";
97 shortName = "be-by";
98 shortDescription = "Belarussian";
99 dictFileName = "be_BY";
100 readmeFileName = "be_BY";
101 };
102
103 # BULGARIAN
104
105 bg_BG = bg-bg;
106 bg-bg = mkDictFromLibreofficeGit {
107 subdir = "bg_BG";
108 shortName = "bg-bg";
109 shortDescription = "Bulgarian";
110 dictFileName = "bg_BG";
111 readmeFileName = "hyph_bg_BG";
112 };
113
114 # CATALAN
115
116 ca_ES = ca-es;
117 ca-es = mkDictFromLibreofficeGitCustom {
118 subdir = "ca";
119 shortName = "ca-es";
120 shortDescription = "Catalan";
121 dictFilePath = "dictionaries/hyph_ca.dic";
122 readmeFilePath = "README_hyph_ca.txt";
123 };
124
125 # CZECH
126
127 cs_CZ = cs-cz;
128 cs-cz = mkDictFromLibreofficeGit {
129 subdir = "cs_CZ";
130 shortName = "cs-cz";
131 shortDescription = "Czech";
132 dictFileName = "cs_CZ";
133 readmeFileName = "cs";
134 };
135
136 # DANISH
137
138 da_DK = da-dk;
139 da-dk = mkDictFromLibreofficeGitCustom {
140 subdir = "da_DK";
141 shortName = "da-dk";
142 shortDescription = "Danish";
143 dictFilePath = "hyph_da_DK.dic";
144 readmeFilePath = "HYPH_da_DK_README.txt";
145 };
146
147 # GERMAN
148
149 de_DE = de-de;
150 de-de = mkDictFromLibreofficeGit {
151 subdir = "de";
152 shortName = "de-de";
153 shortDescription = "German (Germany)";
154 dictFileName = "de_DE";
155 readmeFileName = "hyph_de";
156 };
157
158 de_AT = de-at;
159 de-at = mkDictFromLibreofficeGit {
160 subdir = "de";
161 shortName = "de-at";
162 shortDescription = "German (Austria)";
163 dictFileName = "de_AT";
164 readmeFileName = "hyph_de";
165 };
166
167 de_CH = de-ch;
168 de-ch = mkDictFromLibreofficeGit {
169 subdir = "de";
170 shortName = "de-ch";
171 shortDescription = "German (Switzerland)";
172 dictFileName = "de_CH";
173 readmeFileName = "hyph_de";
174 };
175
176 # GREEK
177
178 el_GR = el-gr;
179 el-gr = mkDictFromLibreofficeGit {
180 subdir = "el_GR";
181 shortName = "el-gr";
182 shortDescription = "Greek";
183 dictFileName = "el_GR";
184 readmeFileName = "hyph_el_GR";
185 };
186
187 # ENGLISH
188
189 en_GB = en-gb;
190 en-gb = mkDictFromLibreofficeGit {
191 subdir = "en";
192 shortName = "en-gb";
193 shortDescription = "English (Great Britain)";
194 dictFileName = "en_GB";
195 readmeFileName = "hyph_en_GB";
196 };
197
198 en_US = en-us;
199 en-us = stdenv.mkDerivation {
200 nativeBuildInputs = hyphen.nativeBuildInputs;
201 version = hyphen.version;
202 pname = "hyphen-dict-en-us";
203 src = hyphen.src;
204 meta = {
205 inherit (hyphen.meta)
206 homepage
207 platforms
208 license
209 maintainers
210 ;
211 description = "Hyphen dictionary for English (United States)";
212 };
213 installPhase = ''
214 runHook preInstall
215 make install-hyphDATA
216 runHook postInstall
217 '';
218 };
219
220 # ESPERANTO
221
222 eo = mkDictFromLibreofficeGitCustom {
223 subdir = "eo";
224 shortName = "eo";
225 shortDescription = "Esperanto";
226 dictFilePath = "hyph_eo.dic";
227 readmeFilePath = "desc_eo.txt";
228 };
229
230 # SPANISH
231
232 es_ES = es-es;
233 es-es = mkDictFromLibreofficeGit {
234 subdir = "es";
235 shortName = "es-es";
236 shortDescription = "Spanish (Spain)";
237 dictFileName = "es";
238 readmeFileName = "hyph_es";
239 };
240
241 # ESTONIAN
242
243 et_EE = et-ee;
244 et-ee = mkDictFromLibreofficeGit {
245 subdir = "et_EE";
246 shortName = "et-ee";
247 shortDescription = "Estonian";
248 dictFileName = "et_EE";
249 readmeFileName = "hyph_et_EE";
250 };
251
252 # FRENCH
253
254 fr_FR = fr-fr;
255 fr-fr = mkDictFromLibreofficeGit {
256 subdir = "fr_FR";
257 shortName = "fr-fr";
258 shortDescription = "French";
259 dictFileName = "fr";
260 readmeFileName = "hyph_fr";
261 };
262
263 # CROATIAN
264
265 hr_HR = hr-hr;
266 hr-hr = mkDictFromLibreofficeGit {
267 subdir = "hr_HR";
268 shortName = "hr-hr";
269 shortDescription = "Croatian";
270 dictFileName = "hr_HR";
271 readmeFileName = "hyph_hr_HR";
272 };
273
274 # HUNGARIAN
275
276 hu_HU = hu-hu;
277 hu-hu = mkDictFromLibreofficeGit {
278 subdir = "hu_HU";
279 shortName = "hu-hu";
280 shortDescription = "Hungarian";
281 dictFileName = "hu_HU";
282 readmeFileName = "hyph_hu_HU";
283 };
284
285 # INDONESIAN
286
287 id_ID = id-id;
288 id-id = mkDictFromLibreofficeGitCustom {
289 subdir = "id";
290 shortName = "id-id";
291 shortDescription = "Indonesian";
292 dictFilePath = "hyph_id_ID.dic";
293 readmeFilePath = "README-dict.adoc";
294 };
295
296 # ITALIAN
297
298 it_IT = it-it;
299 it-it = mkDictFromLibreofficeGit {
300 subdir = "it_IT";
301 shortName = "it-it";
302 shortDescription = "Italian";
303 dictFileName = "it_IT";
304 readmeFileName = "hyph_it_IT";
305 };
306
307 # LITHUANIAN
308
309 lt_LT = lt-lt;
310 lt-lt = mkDictFromLibreofficeGitCustom {
311 subdir = "lt_LT";
312 shortName = "lt-lt";
313 shortDescription = "Lithuanian";
314 dictFilePath = "hyph_lt.dic";
315 readmeFilePath = "README_hyph";
316 };
317
318 # LATVIAN
319
320 lv_LV = lv-lv;
321 lv-lv = mkDictFromLibreofficeGit {
322 subdir = "lv_LV";
323 shortName = "lv-lv";
324 shortDescription = "Latvian";
325 dictFileName = "lv_LV";
326 readmeFileName = "hyph_lv_LV";
327 };
328
329 # MONGOLIAN
330
331 mn_MN = mn-mn;
332 mn-mn = mkDictFromLibreofficeGit {
333 subdir = "mn_MN";
334 shortName = "mn-mn";
335 shortDescription = "Mongolian";
336 dictFileName = "mn_MN";
337 readmeFileName = "mn_MN";
338 };
339
340 # DUTCH
341
342 nl_NL = nl-nl;
343 nl-nl = mkDictFromLibreofficeGit {
344 subdir = "nl_NL";
345 shortName = "nl-nl";
346 shortDescription = "Dutch";
347 dictFileName = "nl_NL";
348 readmeFileName = "NL";
349 };
350
351 # NORWEGIAN
352
353 nb_NO = nb-no;
354 nb-no = mkDictFromLibreofficeGit {
355 subdir = "no";
356 shortName = "nb-no";
357 shortDescription = "Norwegian (Bokmål)";
358 dictFileName = "nb_NO";
359 readmeFileName = "hyph_NO";
360 };
361
362 nn_NO = nn-no;
363 nn-no = mkDictFromLibreofficeGit {
364 subdir = "no";
365 shortName = "nn-no";
366 shortDescription = "Norwegian (Nynorsk)";
367 dictFileName = "nn_NO";
368 readmeFileName = "hyph_NO";
369 };
370
371 # POLISH
372
373 pl_PL = pl-pl;
374 pl-pl = mkDictFromLibreofficeGit {
375 subdir = "pl_PL";
376 shortName = "pl-pl";
377 shortDescription = "Polish";
378 dictFileName = "pl_PL";
379 readmeFileName = "pl";
380 };
381
382 # PORTUGUESE
383
384 pt_BR = pt-br;
385 pt-br = mkDictFromLibreofficeGit {
386 subdir = "pt_BR";
387 shortName = "pt-br";
388 shortDescription = "Portuguese (Brazil)";
389 dictFileName = "pt_BR";
390 readmeFileName = "hyph_pt_BR";
391 };
392
393 pt_PT = pt-pt;
394 pt-pt = mkDictFromLibreofficeGit {
395 subdir = "pt_PT";
396 shortName = "pt-pt";
397 shortDescription = "Portuguese (Portugal)";
398 dictFileName = "pt_PT";
399 readmeFileName = "hyph_pt_PT";
400 };
401
402 # ROMANIAN
403
404 ro_RO = ro-ro;
405 ro-ro = mkDictFromLibreofficeGit {
406 subdir = "ro";
407 shortName = "ro-ro";
408 shortDescription = "Romanian";
409 dictFileName = "ro_RO";
410 readmeFileName = "RO";
411 };
412
413 # RUSSIAN
414
415 ru_RU = ru-ru;
416 ru-ru = mkDictFromLibreofficeGit {
417 subdir = "ru_RU";
418 shortName = "ru-ru";
419 shortDescription = "Russian (Russia)";
420 dictFileName = "ru_RU";
421 readmeFileName = "ru_RU";
422 };
423
424 # SLOVAK
425
426 sk_SK = sk-sk;
427 sk-sk = mkDictFromLibreofficeGit {
428 subdir = "sk_SK";
429 shortName = "sk-sk";
430 shortDescription = "Slovak";
431 dictFileName = "sk_SK";
432 readmeFileName = "sk";
433 };
434
435 # SLOVENIAN
436
437 sl_SI = sl-si;
438 sl-si = mkDictFromLibreofficeGit {
439 subdir = "sl_SI";
440 shortName = "sl-si";
441 shortDescription = "Slovenian";
442 dictFileName = "sl_SI";
443 readmeFileName = "hyph_sl_SI";
444 };
445
446 # ALBANIAN
447
448 sq_AL = sq-al;
449 sq-al = mkDictFromLibreofficeGit {
450 subdir = "sq_AL";
451 shortName = "sq-al";
452 shortDescription = "Albanian";
453 dictFileName = "sq_AL";
454 readmeFileName = "hyph_sq_AL";
455 };
456
457 # SERBIAN
458
459 sr_SR = sr-sr;
460 sr-sr = mkDictFromLibreofficeGitCustom {
461 subdir = "sr";
462 shortName = "sr-sr";
463 shortDescription = "Serbian (Cyrillic)";
464 dictFilePath = "hyph_sr.dic";
465 readmeFilePath = "README.txt";
466 };
467
468 sr_SR_LATN = sr-sr-latn;
469 sr-sr-latn = mkDictFromLibreofficeGitCustom {
470 subdir = "sr";
471 shortName = "sr-sr-latn";
472 shortDescription = "Serbian (Latin)";
473 dictFilePath = "hyph_sr-Latn.dic";
474 readmeFilePath = "README.txt";
475 };
476
477 # SWEDISH
478
479 sv_SE = sv-se;
480 sv-se = mkDictFromLibreofficeGit {
481 subdir = "sv_SE";
482 shortName = "sv-se";
483 shortDescription = "Swedish";
484 dictFileName = "sv";
485 readmeFileName = "hyph_sv";
486 };
487
488 # TELUGU
489
490 te_IN = te-in;
491 te-in = mkDictFromLibreofficeGit {
492 subdir = "te_IN";
493 shortName = "te-in";
494 shortDescription = "Telugu";
495 dictFileName = "te_IN";
496 readmeFileName = "hyph_te_IN";
497 };
498
499 # THAI
500
501 th_TH = th-th;
502 th-th = mkDictFromLibreofficeGit {
503 subdir = "th_TH";
504 shortName = "th-th";
505 shortDescription = "Thai";
506 dictFileName = "th_TH";
507 readmeFileName = "hyph_th_TH";
508 };
509
510 # UKRAINIAN
511
512 uk_UA = uk-ua;
513 uk-ua = mkDictFromLibreofficeGit {
514 subdir = "uk_UA";
515 shortName = "uk-ua";
516 shortDescription = "Ukrainian";
517 dictFileName = "uk_UA";
518 readmeFileName = "hyph_uk_UA";
519 };
520
521 # ZULU
522
523 zu_ZA = zu-za;
524 zu-za = mkDictFromLibreofficeGitCustom {
525 subdir = "zu_ZA";
526 shortName = "zu-za";
527 shortDescription = "Zulu";
528 dictFilePath = "hyph_zu_ZA.dic";
529 # no readme file provided, leave empty
530 };
531
532 };
533
534in
535dicts
536// {
537 all = symlinkJoin {
538 name = "hyphen-all";
539 paths = lib.unique (lib.attrValues dicts);
540 };
541}