about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix74
1 files changed, 74 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix b/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix
new file mode 100644
index 000000000000..0d7f06039a09
--- /dev/null
+++ b/nixpkgs/pkgs/tools/inputmethods/ibus-engines/ibus-cangjie/default.nix
@@ -0,0 +1,74 @@
+{ 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";
+    homepage = "https://github.com/Cangjians/ibus-cangjie";
+    license = lib.licenses.gpl3Plus;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ adisbladis ];
+  };
+}