about summary refs log tree commit diff
path: root/pkgs/tools/inputmethods
diff options
context:
space:
mode:
authorEric Sagnes <eric.sagnes@gmail.com>2016-07-12 00:50:22 +0900
committerRobin Gloster <mail@glob.in>2016-07-11 17:50:22 +0200
commit1349cd4e8dac7d18e92e176e72d49bad9bc90472 (patch)
treead86a65656e5ff5890d61b3d360929d8d2933b41 /pkgs/tools/inputmethods
parent60887fa193297f3fe635e646ecba08259978fa43 (diff)
downloadnixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar.gz
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar.bz2
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar.lz
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar.xz
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.tar.zst
nixlib-1349cd4e8dac7d18e92e176e72d49bad9bc90472.zip
fcitx: refactor (#16858)
Diffstat (limited to 'pkgs/tools/inputmethods')
-rw-r--r--pkgs/tools/inputmethods/fcitx/default.nix58
-rw-r--r--pkgs/tools/inputmethods/fcitx/unwrapped.nix51
2 files changed, 60 insertions, 49 deletions
diff --git a/pkgs/tools/inputmethods/fcitx/default.nix b/pkgs/tools/inputmethods/fcitx/default.nix
index ba3a3f76ed93..69e4425d8c3b 100644
--- a/pkgs/tools/inputmethods/fcitx/default.nix
+++ b/pkgs/tools/inputmethods/fcitx/default.nix
@@ -1,51 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, cmake, intltool, gettext
-, libxml2, enchant, isocodes, icu, libpthreadstubs
-, pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon
-, dbus, gtk2, gtk3, qt4, kde5
-}:
+{ callPackage, plugins ? [] }:
 
-stdenv.mkDerivation rec {
-  name = "fcitx-${version}";
-  version = "4.2.9.1";
-
-  src = fetchurl {
-    url    = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
-    sha256 = "0xvcmm4yi7kagf55d0yl3ql5ssbkm9410fwbz3kd988pchichdsk";
-  };
-
-  postUnpack = ''
-    ln -s ${kde5.extra-cmake-modules}/share/ECM/modules/ECMFindModuleHelpers.cmake \
-      $sourceRoot/cmake/
-  '';
-
-  patches = [ ./fcitx-ecm.patch ];
-
-  postPatch = ''
-    substituteInPlace src/frontend/qt/CMakeLists.txt \
-      --replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
-  '';
-
-  buildInputs = [
-    cmake enchant gettext isocodes pkgconfig intltool icu
-    libpthreadstubs libXau libXdmcp libxkbfile libxkbcommon libxml2
-    dbus cairo gtk2 gtk3 pango qt4
-  ];
-
-  cmakeFlags = ''
-    -DENABLE_QT_IM_MODULE=ON
-    -DENABLE_GTK2_IM_MODULE=ON
-    -DENABLE_GTK3_IM_MODULE=ON
-    -DENABLE_GIR=OFF
-    -DENABLE_OPENCC=OFF
-    -DENABLE_PRESAGE=OFF
-    -DENABLE_XDGAUTOSTART=OFF
-  '';
-
-  meta = with stdenv.lib; {
-    homepage    = "https://github.com/fcitx/fcitx";
-    description = "A Flexible Input Method Framework";
-    license     = licenses.gpl2;
-    platforms   = platforms.linux;
-    maintainers = with maintainers; [ ericsagnes ];
+let 
+  unwrapped = callPackage ./unwrapped.nix { };
+  wrapped   = callPackage ./wrapper.nix {
+    plugins = plugins;
+    fcitx   = unwrapped;
   };
-}
+in if plugins == [] 
+   then unwrapped
+   else wrapped
diff --git a/pkgs/tools/inputmethods/fcitx/unwrapped.nix b/pkgs/tools/inputmethods/fcitx/unwrapped.nix
new file mode 100644
index 000000000000..ba3a3f76ed93
--- /dev/null
+++ b/pkgs/tools/inputmethods/fcitx/unwrapped.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, pkgconfig, cmake, intltool, gettext
+, libxml2, enchant, isocodes, icu, libpthreadstubs
+, pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon
+, dbus, gtk2, gtk3, qt4, kde5
+}:
+
+stdenv.mkDerivation rec {
+  name = "fcitx-${version}";
+  version = "4.2.9.1";
+
+  src = fetchurl {
+    url    = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
+    sha256 = "0xvcmm4yi7kagf55d0yl3ql5ssbkm9410fwbz3kd988pchichdsk";
+  };
+
+  postUnpack = ''
+    ln -s ${kde5.extra-cmake-modules}/share/ECM/modules/ECMFindModuleHelpers.cmake \
+      $sourceRoot/cmake/
+  '';
+
+  patches = [ ./fcitx-ecm.patch ];
+
+  postPatch = ''
+    substituteInPlace src/frontend/qt/CMakeLists.txt \
+      --replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
+  '';
+
+  buildInputs = [
+    cmake enchant gettext isocodes pkgconfig intltool icu
+    libpthreadstubs libXau libXdmcp libxkbfile libxkbcommon libxml2
+    dbus cairo gtk2 gtk3 pango qt4
+  ];
+
+  cmakeFlags = ''
+    -DENABLE_QT_IM_MODULE=ON
+    -DENABLE_GTK2_IM_MODULE=ON
+    -DENABLE_GTK3_IM_MODULE=ON
+    -DENABLE_GIR=OFF
+    -DENABLE_OPENCC=OFF
+    -DENABLE_PRESAGE=OFF
+    -DENABLE_XDGAUTOSTART=OFF
+  '';
+
+  meta = with stdenv.lib; {
+    homepage    = "https://github.com/fcitx/fcitx";
+    description = "A Flexible Input Method Framework";
+    license     = licenses.gpl2;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ ericsagnes ];
+  };
+}