about summary refs log tree commit diff
path: root/pkgs/development/libraries/hyphen/dictionaries.nix
blob: dcaa7f062a6a212bffb3097a0a5957f93633b3fd (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* hyphen dictionaries */

{ hyphen, stdenv, lib, fetchgit, fetchurl }:


let
  libreofficeRepository = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git";
  libreofficeCommit = "9e27d044d98e65f89af8c86df722a77be827bdc8";
  libreofficeSubdir = "de";

  mkDictFromLibreofficeGit =
    { subdir, shortName, shortDescription, dictFileName, readmeFileName }:
    stdenv.mkDerivation rec {
      version = "24.8";
      pname = "hyphen-dict-${shortName}-libreoffice";
      src = fetchgit {
        url = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git";
        rev = "a2bf59878dd76685803ec260e15d875746ad6e25";
        hash = "sha256-3CvjgNjsrm4obATK6LmtYob8i2ngTbwP6FB4HlJMPCE=";
      };
      meta = with lib; {
        description = "Hyphen dictionary for ${shortDescription} from LibreOffice";
        homepage = "https://wiki.documentfoundation.org/Development/Dictionaries";
        license = with licenses; [ mpl20 ];
        maintainers = with maintainers; [ theCapypara ];
        platforms = platforms.all;
      };
      phases = [ "unpackPhase" "installPhase" ];
      installPhase = ''
        runHook preInstall
        cd $src/${subdir}
        install -dm755 "$out/share/hyphen"
        install -m644 "hyph_${dictFileName}.dic" "$out/share/hyphen"
        # docs
        install -dm755 "$out/share/doc/"
        install -m644 "README_hyph_${readmeFileName}.txt" "$out/share/doc/${pname}.txt"
        runHook postInstall
      '';
    };

in
rec {

  /* ENGLISH */

  en_US = en-us;
  en-us = stdenv.mkDerivation rec {
    nativeBuildInputs = hyphen.nativeBuildInputs;
    version = hyphen.version;
    pname = "hyphen-dict-en-us";
    src =  hyphen.src;
    meta = {
      inherit (hyphen.meta) homepage platforms license maintainers;
      description = "Hyphen dictionary for English (United States)";
    };
    installPhase = ''
      runHook preInstall
      make install-hyphDATA
      runHook postInstall
    '';
  };

  /* GERMAN */

  de_DE = de-de;
  de-de = mkDictFromLibreofficeGit {
    subdir = "de";
    shortName = "de-de";
    shortDescription = "German (Germany)";
    dictFileName = "de_DE";
    readmeFileName = "de";
  };

  de_AT = de-at;
  de-at = mkDictFromLibreofficeGit {
    subdir = "de";
    shortName = "de-at";
    shortDescription = "German (Austria)";
    dictFileName = "de_AT";
    readmeFileName = "de";
  };

  de_CH = de-ch;
  de-ch = mkDictFromLibreofficeGit {
    subdir = "de";
    shortName = "de-ch";
    shortDescription = "German (Switzerland)";
    dictFileName = "de_CH";
    readmeFileName = "de";
  };
}