about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix
blob: 0e5233ad8b6f70d0fc3fa34b47551099162a8978 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ stdenv
, lib
, fetchFromGitHub
, gettext
, pkg-config
, wrapGAppsHook
, ibus
, glib
, gobject-introspection
, gtk3
, python3
, autoreconfHook
, intltool
}:

let
  pythonModules = with python3.pkgs; [
    pygobject3
    pycangjie
    (toPythonModule ibus)
  ];

  # Upstream builds Python packages as a part of a non-python
  # autotools build, making it awkward to rely on Nixpkgs Python builders.
  # Hence we manually set up PYTHONPATH.
  pythonPath = "$out/${python3.sitePackages}" + ":" + python3.pkgs.makePythonPath pythonModules;

in
stdenv.mkDerivation {
  pname = "ibus-cangjie";
  version = "unstable-2023-07-25";

  src = fetchFromGitHub {
    owner = "Cangjians";
    repo = "ibus-cangjie";
    rev = "46c36f578047bb3cb2ce777217abf528649bc58d";
    sha256 = "sha256-msVqWougc40bVXIonJA6K/VgurnDeR2TdtGKfd9rzwM=";
  };

  buildInputs = [
    glib
    gtk3
    ibus
    python3
  ] ++ pythonModules;

  nativeBuildInputs = [
    autoreconfHook
    intltool
    gettext
    gobject-introspection
    pkg-config
    wrapGAppsHook
  ];

  # Upstream builds Python packages as a part of a non-python
  # autotools build, making it awkward to rely on Nixpkgs Python builders.
  postInstall = ''
    gappsWrapperArgs+=(--prefix PYTHONPATH : "${pythonPath}")
  '';

  postFixup = ''
    wrapGApp $out/lib/ibus-cangjie/ibus-engine-cangjie
  '';

  meta = {
    isIbusEngine = true;
    description = "An IBus engine for users of the Cangjie and Quick input methods";
    mainProgram = "ibus-setup-cangjie";
    homepage = "https://github.com/Cangjians/ibus-cangjie";
    license = lib.licenses.gpl3Plus;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ adisbladis ];
  };
}