2021-11-12 14:44:07 +00:00
|
|
|
{ lib, stdenv, fetchurl, buildPackages, libiconv, skktools }:
|
2017-11-25 16:36:55 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# kana to kanji
|
|
|
|
small = fetchurl {
|
2020-09-08 09:08:28 +01:00
|
|
|
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.S";
|
|
|
|
sha256 = "11cjrc8m99hj4xpl2nvzxanlswpapi92vmgk9d6yimdz0jidb6cq";
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
|
|
|
medium = fetchurl {
|
2020-09-08 09:08:28 +01:00
|
|
|
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.M";
|
|
|
|
sha256 = "0pwjp9qjmn9sq6zc0k6632l7dc2dbjn45585ibckvvl9iwfqqxdp";
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
|
|
|
large = fetchurl {
|
2020-09-08 09:08:28 +01:00
|
|
|
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.L";
|
|
|
|
sha256 = "0ps0a7sbkryd6hxvphq14i7g5wci4gvr0vraac8ia2ww67a2xbyc";
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# english to japanese
|
|
|
|
edict = fetchurl {
|
2020-09-08 09:08:28 +01:00
|
|
|
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.edict";
|
|
|
|
sha256 = "1vrwnq0vvjn61nijbln6wfinqg93802d2a8d4ad82n692v83b1li";
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
|
|
|
# misc
|
|
|
|
assoc = fetchurl {
|
2020-09-08 09:08:28 +01:00
|
|
|
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.assoc";
|
|
|
|
sha256 = "1smcbyv6srrhnpl7ic9nqds9nz3g2dgqngmhzkrdlwmvcpvakp1v";
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
2021-11-18 18:47:18 +00:00
|
|
|
|
|
|
|
iconvBin = if stdenv.isDarwin then libiconv else buildPackages.stdenv.cc.libc;
|
2017-11-25 16:36:55 +00:00
|
|
|
in
|
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "skk-dicts-unstable";
|
2020-09-08 09:08:28 +01:00
|
|
|
version = "2020-03-24";
|
2017-11-25 16:36:55 +00:00
|
|
|
srcs = [ small medium large edict assoc ];
|
2021-01-15 09:19:50 +00:00
|
|
|
nativeBuildInputs = [ skktools ] ++ lib.optional stdenv.isDarwin libiconv;
|
2017-11-25 16:36:55 +00:00
|
|
|
|
2021-11-12 14:44:07 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2021-07-17 21:34:46 +01:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2017-11-25 16:36:55 +00:00
|
|
|
installPhase = ''
|
|
|
|
function dictname() {
|
|
|
|
src=$1
|
|
|
|
name=$(basename $src) # remove dir name
|
|
|
|
dict=$(echo $name | cut -b34-) # remove sha256 prefix
|
|
|
|
echo $dict
|
|
|
|
}
|
|
|
|
mkdir -p $out/share
|
|
|
|
|
|
|
|
for src in $srcs; do
|
|
|
|
dst=$out/share/$(dictname $src)
|
|
|
|
echo ";;; -*- coding: utf-8 -*-" > $dst # libskk requires this on the first line
|
2021-11-18 18:47:18 +00:00
|
|
|
${lib.getBin iconvBin}/bin/iconv \
|
2021-11-12 14:44:07 +00:00
|
|
|
-f EUC-JP -t UTF-8 $src | skkdic-expr2 >> $dst
|
2017-11-25 16:36:55 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# combine .L .edict and .assoc for convenience
|
|
|
|
dst=$out/share/SKK-JISYO.combined
|
|
|
|
echo ";;; -*- coding: utf-8 -*-" > $dst
|
2021-11-12 14:44:07 +00:00
|
|
|
skkdic-expr2 \
|
2017-11-25 16:36:55 +00:00
|
|
|
$out/share/$(dictname ${large}) + \
|
|
|
|
$out/share/$(dictname ${edict}) + \
|
|
|
|
$out/share/$(dictname ${assoc}) >> $dst
|
|
|
|
'';
|
|
|
|
|
2021-11-12 15:11:25 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-11-12 15:31:45 +00:00
|
|
|
meta = with lib; {
|
2017-11-25 16:36:55 +00:00
|
|
|
description = "A collection of standard SKK dictionaries";
|
|
|
|
longDescription = ''
|
|
|
|
This package provides a collection of standard kana-to-kanji
|
|
|
|
dictionaries for the SKK Japanese input method.
|
|
|
|
'';
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/skk-dev/dict";
|
2021-11-12 15:31:45 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
maintainers = with maintainers; [ yuriaisaka ];
|
|
|
|
platforms = platforms.all;
|
2017-11-25 16:36:55 +00:00
|
|
|
};
|
|
|
|
}
|