summary refs log tree commit diff
path: root/pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
blob: 3d78a8ec69e7df74d6351ffc4544c781f97bed3e (plain) (blame)
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
{ stdenv, fetchurl, makeWrapper, ibus, pkgconfig, python3, pygobject3
, gtk3, atk, dconf, gobjectIntrospection }:

stdenv.mkDerivation rec {
  name = "ibus-table-${version}";
  version = "1.9.11";

  src = fetchurl {
    url = "https://github.com/kaio/ibus-table/releases/download/${version}/${name}.tar.gz";
    sha256 = "14sb89z1inbbhcrbsm5nww8la04ncy2lk32mxfqpi4ghl22ixxqd";
  };

  postPatch = ''
    # Data paths will be set at run-time.
    sed -e "/export IBUS_TABLE_LIB_LOCATION=/ s/^.*$//" \
        -e "/export IBUS_TABLE_LOCATION=/ s/^.*$//" \
        -i "engine/ibus-engine-table.in"
    sed -e "/export IBUS_TABLE_BIN_PATH=/ s/^.*$//" \
        -e "/export IBUS_TABLE_DATA_DIR=/ s/^.*$//" \
        -i "engine/ibus-table-createdb.in"
    sed -e "/export IBUS_PREFIX=/ s/^.*$//" \
        -e "/export IBUS_DATAROOTDIR=/ s/^.$//" \
        -e "/export IBUS_LOCALEDIR=/ s/^.$//" \
        -i "setup/ibus-setup-table.in"
  '';

  buildInputs = [
    gtk3 dconf gobjectIntrospection
    ibus
    pkgconfig
    python3 pygobject3
  ];

  nativeBuildInputs = [ makeWrapper ];

  preFixup = ''
    for prog in "$out/bin"/*; do #*/
      wrapProgram "$prog" \
        --prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
        --prefix PYTHONPATH : "$PYTHONPATH" \
        --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
        --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules"
    done

    for prog in "$out/libexec"/*; do #*/
      wrapProgram "$prog" \
        --prefix PYTHONPATH : "$PYTHONPATH" \
        --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0"
    done
  '';

  meta = with stdenv.lib; {
    isIbusEngine = true;
    description  = "An IBus framework for table-based input methods";
    homepage     = https://github.com/kaio/ibus-table/wiki;
    license      = licenses.lgpl21;
    platforms    = platforms.linux;
    maintainers  = with maintainers; [ mudri ];
  };
}