2023-07-15 17:15:38 +00:00
|
|
|
{ lib, stdenv, fetchurl, python3, dict, glibcLocales, libfaketime }:
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "dict-db-wiktionary";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "20220420";
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://dumps.wikimedia.org/enwiktionary/${version}/enwiktionary-${version}-pages-articles.xml.bz2";
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "qsha26LL2513SDtriE/0zdPX1zlnpzk1KKk+R9dSdew=";
|
2021-02-13 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ python3 dict glibcLocales libfaketime ];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share/dictd/
|
|
|
|
cd $out/share/dictd
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
source_date=$(date --utc --date=@$SOURCE_DATE_EPOCH "+%F %T")
|
|
|
|
faketime -f "$source_date" ${python3.interpreter} -O ${./wiktionary2dict.py} "${src}"
|
|
|
|
faketime -f "$source_date" dictzip wiktionary-en.dict
|
2021-08-05 21:33:18 +00:00
|
|
|
echo en_US.UTF-8 > locale
|
|
|
|
'';
|
2021-02-13 14:23:35 +00:00
|
|
|
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "DICT version of English Wiktionary";
|
2021-08-05 21:33:18 +00:00
|
|
|
homepage = "https://en.wiktionary.org/";
|
2021-02-13 14:23:35 +00:00
|
|
|
maintainers = with maintainers; [ qyliss ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
license = with licenses; [ cc-by-sa-30 fdl11Plus ];
|
|
|
|
};
|
|
|
|
}
|