toxic: 0.15.1 -> 0.16.0
[NixPkgs.git] / pkgs / by-name / me / merge-ut-dictionaries / package.nix
blob130a89016a488ab53254d142d0e65bc73a56d998
2   lib,
3   fetchFromGitHub,
4   stdenvNoCC,
5   nix-update-script,
6   python3,
7   jawiki-all-titles-in-ns0,
8   ibus-engines,
10   mozcdic-ut-jawiki,
11   mozcdic-ut-personal-names,
12   mozcdic-ut-place-names,
13   mozcdic-ut-sudachidict,
15   dictionaries ? [
16     mozcdic-ut-jawiki
17     mozcdic-ut-personal-names
18     mozcdic-ut-place-names
19     mozcdic-ut-sudachidict
20   ],
23 assert lib.assertMsg (dictionaries != [ ]) "merge-ut-dictionaries needs at least one dictionary.";
25 stdenvNoCC.mkDerivation {
26   pname = "merge-ut-dictionaries";
27   version = "0-unstable-2024-10-13";
29   src = fetchFromGitHub {
30     owner = "utuhiro78";
31     repo = "merge-ut-dictionaries";
32     rev = "4e08ad0bc0e493a35e9408edf963a3e77257b4cf";
33     hash = "sha256-o+4a2FdMfKnCrZ7b+gbVwCBxs72M0QY4C8EnNyBZqXU=";
34   };
36   nativeBuildInputs = [ python3 ];
38   preConfigure = ''
39     cd src
41     substituteInPlace make.sh \
42       --replace-fail "git" "true #" \
43       --replace-fail "mv mozcdic-ut" "#"
45     substituteInPlace count_word_hits.py \
46       --replace-fail 'subprocess.run' "#" \
47       --replace-fail "jawiki-latest-all-titles-in-ns0.gz" "${jawiki-all-titles-in-ns0}/jawiki-all-titles-in-ns0.gz"
49     substituteInPlace remove_duplicate_ut_entries.py \
50       --replace-fail "url =" 'url = "${ibus-engines.mozc.src}/src/data/dictionary_oss/id.def"#' \
51       --replace-fail "urllib.request.urlopen" "open" \
52       --replace-fail "read().decode()" "read()"
54     for dir in ${lib.concatStringsSep " " dictionaries}; do
55       cp -v $dir/mozcdic-ut-*.txt.tar.bz2 .
56     done
57   '';
59   buildPhase = ''
60     runHook preBuild
62     bash make.sh
64     runHook postBuild
65   '';
67   installPhase = ''
68     runHook preInstall
69     install -Dt $out mozcdic-ut.txt
70     runHook postInstall
71   '';
73   passthru.updateScript = nix-update-script {
74     extraArgs = [
75       "--version"
76       "branch"
77     ];
78   };
80   meta = {
81     description = "Mozc UT dictionaries are additional dictionaries for Mozc.";
82     homepage = "https://github.com/utuhiro78/merge-ut-dictionaries";
83     license = lib.licenses.asl20;
84     maintainers = with lib.maintainers; [ pineapplehunter ];
85     platforms = lib.platforms.all;
86     # this does not need to be separately built
87     # it only provides a dictionary
88     hydraPlatforms = [ ];
89   };