lol

fcitx: refactor (#16858)

authored by

Eric Sagnes and committed by
Robin Gloster
1349cd4e 60887fa1

+64 -55
+1 -1
nixos/modules/i18n/input-method/fcitx.nix
··· 4 4 5 5 let 6 6 cfg = config.i18n.inputMethod.fcitx; 7 - fcitxPackage = pkgs.fcitx-with-plugins.override { plugins = cfg.engines; }; 7 + fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; }; 8 8 fcitxEngine = types.package // { 9 9 name = "fcitx-engine"; 10 10 check = x: (lib.types.package.check x) && (attrByPath ["meta" "isFcitxEngine"] false x);
+9 -49
pkgs/tools/inputmethods/fcitx/default.nix
··· 1 - { stdenv, fetchurl, pkgconfig, cmake, intltool, gettext 2 - , libxml2, enchant, isocodes, icu, libpthreadstubs 3 - , pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon 4 - , dbus, gtk2, gtk3, qt4, kde5 5 - }: 6 - 7 - stdenv.mkDerivation rec { 8 - name = "fcitx-${version}"; 9 - version = "4.2.9.1"; 10 - 11 - src = fetchurl { 12 - url = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz"; 13 - sha256 = "0xvcmm4yi7kagf55d0yl3ql5ssbkm9410fwbz3kd988pchichdsk"; 14 - }; 15 - 16 - postUnpack = '' 17 - ln -s ${kde5.extra-cmake-modules}/share/ECM/modules/ECMFindModuleHelpers.cmake \ 18 - $sourceRoot/cmake/ 19 - ''; 20 - 21 - patches = [ ./fcitx-ecm.patch ]; 22 - 23 - postPatch = '' 24 - substituteInPlace src/frontend/qt/CMakeLists.txt \ 25 - --replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins 26 - ''; 27 - 28 - buildInputs = [ 29 - cmake enchant gettext isocodes pkgconfig intltool icu 30 - libpthreadstubs libXau libXdmcp libxkbfile libxkbcommon libxml2 31 - dbus cairo gtk2 gtk3 pango qt4 32 - ]; 1 + { callPackage, plugins ? [] }: 33 2 34 - cmakeFlags = '' 35 - -DENABLE_QT_IM_MODULE=ON 36 - -DENABLE_GTK2_IM_MODULE=ON 37 - -DENABLE_GTK3_IM_MODULE=ON 38 - -DENABLE_GIR=OFF 39 - -DENABLE_OPENCC=OFF 40 - -DENABLE_PRESAGE=OFF 41 - -DENABLE_XDGAUTOSTART=OFF 42 - ''; 43 - 44 - meta = with stdenv.lib; { 45 - homepage = "https://github.com/fcitx/fcitx"; 46 - description = "A Flexible Input Method Framework"; 47 - license = licenses.gpl2; 48 - platforms = platforms.linux; 49 - maintainers = with maintainers; [ ericsagnes ]; 3 + let 4 + unwrapped = callPackage ./unwrapped.nix { }; 5 + wrapped = callPackage ./wrapper.nix { 6 + plugins = plugins; 7 + fcitx = unwrapped; 50 8 }; 51 - } 9 + in if plugins == [] 10 + then unwrapped 11 + else wrapped
+51
pkgs/tools/inputmethods/fcitx/unwrapped.nix
··· 1 + { stdenv, fetchurl, pkgconfig, cmake, intltool, gettext 2 + , libxml2, enchant, isocodes, icu, libpthreadstubs 3 + , pango, cairo, libxkbfile, libXau, libXdmcp, libxkbcommon 4 + , dbus, gtk2, gtk3, qt4, kde5 5 + }: 6 + 7 + stdenv.mkDerivation rec { 8 + name = "fcitx-${version}"; 9 + version = "4.2.9.1"; 10 + 11 + src = fetchurl { 12 + url = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz"; 13 + sha256 = "0xvcmm4yi7kagf55d0yl3ql5ssbkm9410fwbz3kd988pchichdsk"; 14 + }; 15 + 16 + postUnpack = '' 17 + ln -s ${kde5.extra-cmake-modules}/share/ECM/modules/ECMFindModuleHelpers.cmake \ 18 + $sourceRoot/cmake/ 19 + ''; 20 + 21 + patches = [ ./fcitx-ecm.patch ]; 22 + 23 + postPatch = '' 24 + substituteInPlace src/frontend/qt/CMakeLists.txt \ 25 + --replace $\{QT_PLUGINS_DIR} $out/lib/qt4/plugins 26 + ''; 27 + 28 + buildInputs = [ 29 + cmake enchant gettext isocodes pkgconfig intltool icu 30 + libpthreadstubs libXau libXdmcp libxkbfile libxkbcommon libxml2 31 + dbus cairo gtk2 gtk3 pango qt4 32 + ]; 33 + 34 + cmakeFlags = '' 35 + -DENABLE_QT_IM_MODULE=ON 36 + -DENABLE_GTK2_IM_MODULE=ON 37 + -DENABLE_GTK3_IM_MODULE=ON 38 + -DENABLE_GIR=OFF 39 + -DENABLE_OPENCC=OFF 40 + -DENABLE_PRESAGE=OFF 41 + -DENABLE_XDGAUTOSTART=OFF 42 + ''; 43 + 44 + meta = with stdenv.lib; { 45 + homepage = "https://github.com/fcitx/fcitx"; 46 + description = "A Flexible Input Method Framework"; 47 + license = licenses.gpl2; 48 + platforms = platforms.linux; 49 + maintainers = with maintainers; [ ericsagnes ]; 50 + }; 51 + }
+3 -5
pkgs/top-level/all-packages.nix
··· 1496 1496 1497 1497 fatsort = callPackage ../tools/filesystems/fatsort { }; 1498 1498 1499 - fcitx = callPackage ../tools/inputmethods/fcitx { }; 1499 + fcitx = callPackage ../tools/inputmethods/fcitx { 1500 + plugins = []; 1501 + }; 1500 1502 1501 1503 fcitx-engines = recurseIntoAttrs { 1502 1504 ··· 1519 1521 }; 1520 1522 1521 1523 fcitx-configtool = callPackage ../tools/inputmethods/fcitx/fcitx-configtool.nix { }; 1522 - 1523 - fcitx-with-plugins = callPackage ../tools/inputmethods/fcitx/wrapper.nix { 1524 - plugins = [ ]; 1525 - }; 1526 1524 1527 1525 fcppt = callPackage ../development/libraries/fcppt/default.nix { }; 1528 1526