aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-rime/default.nix
blob: 03a801abbeb01090d568d0ec7f045a3741e4130d (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
{ stdenv, fetchFromGitHub, cmake, pkg-config, gdk-pixbuf, glib, ibus, libnotify
, librime, brise }:

stdenv.mkDerivation rec {
  pname = "ibus-rime";
  version = "1.4.0";

  src = fetchFromGitHub {
    owner = "rime";
    repo = "ibus-rime";
    rev = version;
    sha256 = "0zbajz7i18vrqwdyclzywvsjg6qzaih64jhi3pkxp7mbw8jc5vhy";
  };

  buildInputs = [ gdk-pixbuf glib ibus libnotify librime brise ];
  nativeBuildInputs = [ cmake pkg-config ];

  makeFlags = [ "PREFIX=$(out)" ];
  dontUseCmakeConfigure = true;

  prePatch = ''
    substituteInPlace Makefile \
       --replace 'cmake' 'cmake -DRIME_DATA_DIR=${brise}/share/rime-data'

    substituteInPlace rime_config.h \
       --replace '/usr' $out

    substituteInPlace rime_config.h \
       --replace 'IBUS_RIME_SHARED_DATA_DIR IBUS_RIME_INSTALL_PREFIX' \
                 'IBUS_RIME_SHARED_DATA_DIR "${brise}"'

    substituteInPlace rime.xml \
       --replace '/usr' $out
  '';

  meta = with stdenv.lib; {
    isIbusEngine = true;
    description = "Rime input method engine for IBus";
    homepage = "https://rime.im/";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ pengmeiyu ];
  };
}