-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
/
package.nix
90 lines (73 loc) · 2.19 KB
/
package.nix
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
{
lib,
fetchFromGitHub,
stdenvNoCC,
nix-update-script,
python3,
jawiki-all-titles-in-ns0,
ibus-engines,
mozcdic-ut-jawiki,
mozcdic-ut-personal-names,
mozcdic-ut-place-names,
mozcdic-ut-sudachidict,
dictionaries ? [
mozcdic-ut-jawiki
mozcdic-ut-personal-names
mozcdic-ut-place-names
mozcdic-ut-sudachidict
],
}:
assert lib.assertMsg (dictionaries != [ ]) "merge-ut-dictionaries needs at least one dictionary.";
stdenvNoCC.mkDerivation {
pname = "merge-ut-dictionaries";
version = "0-unstable-2024-09-09";
src = fetchFromGitHub {
owner = "utuhiro78";
repo = "merge-ut-dictionaries";
rev = "35dfcca5c8657f2bf78bc000baa349c322ecb771";
hash = "sha256-s6m430nXrG5v6iA+Fp2CKDPfFoAZirw/c3WahLrsaL4=";
};
nativeBuildInputs = [ python3 ];
preConfigure = ''
cd src
substituteInPlace make.sh \
--replace-fail "git" "true #" \
--replace-fail "mv mozcdic-ut" "#"
substituteInPlace count_word_hits.py \
--replace-fail 'subprocess.run' "#" \
--replace-fail "jawiki-latest-all-titles-in-ns0.gz" "${jawiki-all-titles-in-ns0}/jawiki-all-titles-in-ns0.gz"
substituteInPlace remove_duplicate_ut_entries.py \
--replace-fail "url =" 'url = "${ibus-engines.mozc.src}/src/data/dictionary_oss/id.def"#' \
--replace-fail "urllib.request.urlopen" "open" \
--replace-fail "read().decode()" "read()"
for dir in ${lib.concatStringsSep " " dictionaries}; do
cp -v $dir/mozcdic-ut-*.txt.tar.bz2 .
done
'';
buildPhase = ''
runHook preBuild
bash make.sh
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dt $out mozcdic-ut.txt
runHook postInstall
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version"
"branch"
];
};
meta = {
description = "Mozc UT dictionaries are additional dictionaries for Mozc.";
homepage = "https://github.com/utuhiro78/merge-ut-dictionaries";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ pineapplehunter ];
platforms = lib.platforms.all;
# this does not need to be separately built
# it only provides a dictionary
hydraPlatforms = [ ];
};
}