Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 76 additions & 38 deletions pkgs/tools/inputmethods/fcitx/default.nix
Original file line number Diff line number Diff line change
@@ -1,43 +1,81 @@
{ stdenv, fetchurl, pkgconfig, cmake, intltool, gettext
{ lib, stdenv, fetchurl, pkgconfig, cmake, intltool, gettext, which
, libxml2, enchant, isocodes, icu, libpthreadstubs
, pango, cairo, libxkbfile, libXau, libXdmcp
, dbus, gtk2, gtk3, qt4
, plugins ? [ ]
, enableAnthy ? false
}:

stdenv.mkDerivation rec {
name = "fcitx-4.2.8.5";

src = fetchurl {
url = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
sha256 = "0whv7mnzig4l5v518r200psa1fp3dyl1jkr5z0q13ijzh1bnyggy";
};

patchPhase = ''
substituteInPlace src/frontend/qt/CMakeLists.txt \
--replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
'';

buildInputs = with stdenv.lib; [
cmake enchant pango gettext libxml2 isocodes pkgconfig libxkbfile
intltool cairo icu libpthreadstubs libXau libXdmcp
dbus gtk2 gtk3 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 = {
homepage = "https://code.google.com/p/fcitx/";
description = "A Flexible Input Method Framework";
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [iyzsong];
};
}
let
plugs = plugins;
in
stdenv.mkDerivation rec {
name = "fcitx-4.2.8.5";

src = fetchurl {
url = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
sha256 = "0whv7mnzig4l5v518r200psa1fp3dyl1jkr5z0q13ijzh1bnyggy";
};

# Anthy plugin
anthyPluginName = "fcitx-anthy-0.2.1";
anthyPluginSrc = lib.optional enableAnthy (fetchurl {
url = "http://download.fcitx-im.org/fcitx-anthy/${anthyPluginName}.tar.xz";
sha256 = "13fpfhhxkzbq53h10i3hifa37nngm47jq361i70z22bgcrs8887x";
});

patchPhase = ''
substituteInPlace src/frontend/qt/CMakeLists.txt \
--replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins
'';

buildInputs = with lib; [
cmake enchant pango gettext libxml2 isocodes pkgconfig libxkbfile
intltool cairo icu libpthreadstubs libXau libXdmcp
dbus gtk2 gtk3 qt4
]
++ plugs;

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
'';

postInstall = ''
set -e
function installPlugin () {
pluginSearchString="$1"
pluginSrc="$2"
pluginName="$3"

if [[ "$plugins" == *$pluginSearchString* ]] ; then
cd $NIX_BUILD_TOP
unpackFile "$pluginSrc"
cd "$pluginName"

cmakeConfigurePhase
buildPhase
make install
fi
}

export cmakeFlags="$cmakeFlags -DCMAKE_MODULE_PATH=$prefix/share/cmake/fcitx -DCMAKE_PREFIX_PATH=$prefix -DCMAKE_C_FLAGS=-I$prefix/include -DCMAKE_CXX_FLAGS=-I$prefix/include "

installPlugin "anthy" "$anthyPluginSrc" "$anthyPluginName"
'';

plugins = plugs;

meta = {
homepage = "https://code.google.com/p/fcitx/";
description = "A Flexible Input Method Framework";
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [cdepillabout iyzsong];
};
}
24 changes: 0 additions & 24 deletions pkgs/tools/inputmethods/fcitx/fcitx-anthy.nix

This file was deleted.

25 changes: 23 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,32 @@ let

fakechroot = callPackage ../tools/system/fakechroot { };

fcitx-configtool = callPackage ../tools/inputmethods/fcitx/fcitx-configtool.nix { };

# fcitx with no plugins enabled
fcitx = callPackage ../tools/inputmethods/fcitx { };

fcitx-anthy = callPackage ../tools/inputmethods/fcitx/fcitx-anthy.nix { };
# fcitx with all plugins enabled
fcitxWithAllPlugins = callPackage ../tools/inputmethods/fcitx {
enableAnthy = true;
plugins = [ anthy ];
};

fcitx-configtool = callPackage ../tools/inputmethods/fcitx/fcitx-configtool.nix { };
# A wrapper that can be used to define exactly which plugins will be
# disabled and enabled.
fcitxWrapper =
let
cfg = config.fcitx or {};
enableAnthy = cfg.enableAnthy or false;
in
import ../tools/inputmethods/fcitx/default.nix {
inherit lib stdenv fetchurl pkgconfig cmake intltool gettext which;
inherit libxml2 enchant isocodes icu pango cairo dbus gtk2 gtk3 qt4;
inherit (xorg) libxkbfile libpthreadstubs libXau libXdmcp;
enableAnthy = enableAnthy;
plugins =
([ ] ++ lib.optional enableAnthy anthy);
};

fcron = callPackage ../tools/system/fcron { };

Expand Down