summaryrefslogtreecommitdiffstats
path: root/pkgs/servers/dict/dictd-wordnet.nix
blob: 244dac45f06ca6e2196c479a7ba27bc2d3c89c8a (plain)
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
{
  lib,
  stdenv,
  python3,
  wordnet,
  writeScript,
  libfaketime,
}:

stdenv.mkDerivation rec {
  version = "542";
  pname = "dict-db-wordnet";

  buildInputs = [
    python3
    wordnet
    libfaketime
  ];
  convert = ./wordnet_structures.py;

  builder = writeScript "builder.sh" ''
    . ${stdenv}/setup
    mkdir -p $out/share/dictd/
    cd $out/share/dictd

    for i in ${wordnet}/dict/data.*; do
      DATA="$DATA `echo $i | sed -e s,data,index,` $i";
    done

    source_date=$(date --utc --date=@$SOURCE_DATE_EPOCH "+%F %T")
    faketime -f "$source_date" python ${convert} $DATA
    echo en_US.UTF-8 > locale
  '';

  meta = {
    description = "Dictd-compatible version of WordNet";

    longDescription = ''
      WordNet® is a large lexical database of English. This package makes
      the wordnet data available to dictd and by extension for lookup with
      the dict command.
    '';

    homepage = "https://wordnet.princeton.edu/";

    maintainers = [ ];
    platforms = lib.platforms.all;
  };
}