nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 python3,
6 dict,
7 glibcLocales,
8 libfaketime,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "dict-db-wiktionary";
13 version = "20240901";
14
15 src = fetchurl {
16 url = "https://dumps.wikimedia.org/enwiktionary/${version}/enwiktionary-${version}-pages-articles.xml.bz2";
17 sha256 = "f37e899a9091a1b01137c7b0f3d58813edf3039e9e94ae656694c88859bbe756";
18 };
19
20 nativeBuildInputs = [
21 python3
22 dict
23 glibcLocales
24 libfaketime
25 ];
26
27 dontUnpack = true;
28
29 installPhase = ''
30 mkdir -p $out/share/dictd/
31 cd $out/share/dictd
32
33 source_date=$(date --utc --date=@$SOURCE_DATE_EPOCH "+%F %T")
34 faketime -f "$source_date" ${python3.interpreter} -O ${./wiktionary2dict.py} "${src}"
35 faketime -f "$source_date" dictzip wiktionary-en.dict
36 echo en_US.UTF-8 > locale
37 '';
38
39 passthru.updateScript = ./update.sh;
40
41 meta = {
42 description = "DICT version of English Wiktionary";
43 homepage = "https://en.wiktionary.org/";
44 maintainers = with lib.maintainers; [ qyliss ];
45 platforms = lib.platforms.all;
46 license = with lib.licenses; [
47 cc-by-sa-30
48 fdl11Plus
49 ];
50 };
51}