Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / dict / dictd-db.nix
blob2e2191c5aaa3e371746ce1c938516ca22ec57bf2
1 { lib, stdenv, fetchurl, callPackage }:
3 let
4  # Probably a bug in some FreeDict release files, but easier to trivially
5  # work around than report. Not that it can cause any other problems..
6  makeDictdDBFreedict = src: name: locale:
7    makeDictdDB src name "{.,bin}" locale;
9  makeDictdDB = src: _name: _subdir: _locale:
10    stdenv.mkDerivation {
11      name = "dictd-db-${_name}";
12      inherit src;
13      locale = _locale;
14      dbName = _name;
15      dontBuild = true;
16      unpackPhase = ''
17        tar xf  ${src}
18      '';
19      installPhase = ''
20        mkdir -p $out/share/dictd
21        cp $(ls ./${_subdir}/*.{dict*,index} || true) $out/share/dictd
22        echo "${_locale}" >$out/share/dictd/locale
23      '';
25      meta = {
26        description = "dictd-db dictionary for dictd";
27        platforms = lib.platforms.linux;
28      };
29    };
30 in rec {
31   deu2eng = makeDictdDBFreedict (fetchurl {
32     url = "mirror://sourceforge/freedict/deu-eng.tar.gz";
33     sha256 = "0dqrhv04g4f5s84nbgisgcfwk5x0rpincif0yfhfh4sc1bsvzsrb";
34   }) "deu-eng" "de_DE";
35   eng2deu = makeDictdDBFreedict (fetchurl {
36     url = "mirror://sourceforge/freedict/eng-deu.tar.gz";
37     sha256 = "01x12p72sa3071iff3jhzga8588440f07zr56r3x98bspvdlz73r";
38   }) "eng-deu" "en_EN";
39   nld2eng = makeDictdDBFreedict (fetchurl {
40     url = "mirror://sourceforge/freedict/nld-eng.tar.gz";
41     sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07";
42   }) "nld-eng" "nl_NL";
43   eng2nld =  makeDictdDBFreedict (fetchurl {
44     url = "mirror://sourceforge/freedict/eng-nld.tar.gz";
45     sha256 = "0rcg28ldykv0w2mpxc6g4rqmfs33q7pbvf68ssy1q9gpf6mz7vcl";
46   }) "eng-nld" "en_UK";
47   eng2rus = makeDictdDBFreedict (fetchurl {
48     url = "mirror://sourceforge/freedict/eng-rus.tar.gz";
49     sha256 = "15409ivhww1wsfjr05083pv6mg10bak8v5pg1wkiqybk7ck61rry";
50   }) "eng-rus" "en_UK";
51   fra2eng = makeDictdDBFreedict (fetchurl {
52     url = "mirror://sourceforge/freedict/fra-eng.tar.gz";
53     sha256 = "0sdd88s2zs5whiwdf3hd0s4pzzv75sdsccsrm1wxc87l3hjm85z3";
54   }) "fra-eng" "fr_FR";
55   eng2fra = makeDictdDBFreedict (fetchurl {
56     url = "mirror://sourceforge/freedict/eng-fra.tar.gz";
57     sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m";
58   }) "eng-fra" "en_UK";
59   epo2eng = makeDictdDB (fetchurl {
60     url = "https://download.freedict.org/dictionaries/epo-eng/1.0.1/freedict-epo-eng-1.0.1.dictd.tar.xz";
61     sha256 = "095xwqfc43dnm0g74i83lg03542f064jy2xbn3qnjxiwysz9ksnz";
62   }) "epo-eng" "epo-eng" "eo";
63   jpn2eng = makeDictdDB (fetchurl {
64     url = let version = "0.1";
65           in "mirror://sourceforge/freedict/jpn-eng/${version}/freedict-jpn-eng-${version}.dictd.tar.xz";
66     sha256 = "sha256-juJBoEq7EztLZzOomc7uoZhXVaQPKoUvIxxPLB0xByc=";
67   }) "jpn-eng" "jpn-eng" "ja_JP";
68   eng2jpn = makeDictdDB (fetchurl {
69     url = let version = "2022.04.06";
70           in "https://download.freedict.org/dictionaries/eng-jpn/${version}/freedict-eng-jpn-${version}.dictd.tar.xz";
71     sha256 = "sha256-kfRT2kgbV3XKarCr4mqDRT5A1jR8M8APky5M5MFYatE=";
72   }) "eng-jpn" "eng-jpn" "en_UK";
73   mueller_eng2rus_pkg = makeDictdDB (fetchurl {
74     url = "mirror://sourceforge/mueller-dict/mueller-dict-3.1.tar.gz";
75     sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq";
76   }) "mueller-eng-rus" "mueller-dict-*/dict" "en_UK";
77   mueller_enru_abbr = {
78     outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-abbrev";
79     name = "mueller-abbr";
80     dbName = "mueller-abbr";
81     locale = "en_UK";
82   };
83   mueller_enru_base = {
84     outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-base";
85     name = "mueller-base";
86     dbName = "mueller-base";
87     locale = "en_UK";
88   };
89   mueller_enru_dict = {
90     outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-dict";
91     name = "mueller-dict";
92     dbName = "mueller-dict";
93     locale = "en_UK";
94   };
95   mueller_enru_geo = {
96     outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-geo";
97     name = "mueller-geo";
98     dbName = "mueller-geo";
99     locale = "en_UK";
100   };
101   mueller_enru_names = {
102     outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-names";
103     name = "mueller-names";
104     dbName = "mueller-names";
105     locale = "en_UK";
106   };
107   wordnet = callPackage ./dictd-wordnet.nix {};
108   wiktionary = callPackage ./wiktionary {};