1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 gettext,
6 pkg-config,
7 wrapGAppsHook3,
8 ibus,
9 glib,
10 gobject-introspection,
11 gtk3,
12 python3,
13 autoreconfHook,
14 intltool,
15}:
16
17let
18 pythonModules = with python3.pkgs; [
19 pygobject3
20 pycangjie
21 (toPythonModule ibus)
22 ];
23
24 # Upstream builds Python packages as a part of a non-python
25 # autotools build, making it awkward to rely on Nixpkgs Python builders.
26 # Hence we manually set up PYTHONPATH.
27 pythonPath = "$out/${python3.sitePackages}" + ":" + python3.pkgs.makePythonPath pythonModules;
28
29in
30stdenv.mkDerivation {
31 pname = "ibus-cangjie";
32 version = "unstable-2023-07-25";
33
34 src = fetchFromGitHub {
35 owner = "Cangjians";
36 repo = "ibus-cangjie";
37 rev = "46c36f578047bb3cb2ce777217abf528649bc58d";
38 sha256 = "sha256-msVqWougc40bVXIonJA6K/VgurnDeR2TdtGKfd9rzwM=";
39 };
40
41 buildInputs = [
42 glib
43 gtk3
44 ibus
45 python3
46 ]
47 ++ pythonModules;
48
49 nativeBuildInputs = [
50 autoreconfHook
51 intltool
52 gettext
53 gobject-introspection
54 pkg-config
55 wrapGAppsHook3
56 ];
57
58 # Upstream builds Python packages as a part of a non-python
59 # autotools build, making it awkward to rely on Nixpkgs Python builders.
60 postInstall = ''
61 gappsWrapperArgs+=(--prefix PYTHONPATH : "${pythonPath}")
62 '';
63
64 postFixup = ''
65 wrapGApp $out/lib/ibus-cangjie/ibus-engine-cangjie
66 '';
67
68 meta = {
69 isIbusEngine = true;
70 description = "IBus engine for users of the Cangjie and Quick input methods";
71 mainProgram = "ibus-setup-cangjie";
72 homepage = "https://github.com/Cangjians/ibus-cangjie";
73 license = lib.licenses.gpl3Plus;
74 platforms = lib.platforms.linux;
75 maintainers = with lib.maintainers; [ ];
76 };
77}