summary refs log tree commit diff
path: root/pkgs/tools/inputmethods/fcitx
diff options
context:
space:
mode:
author(cdep)illabout <cdep.illabout@gmail.com>2014-11-05 10:23:39 +0900
committer(cdep)illabout <cdep.illabout@gmail.com>2014-11-05 10:37:10 +0900
commitf0c3c54712cb7f4caf5334fbf926723a6af5d0cc (patch)
treee735205dfe48191aa2efb28efa0b0a91d48ba14b /pkgs/tools/inputmethods/fcitx
parentcf665e9fefe136f00ce57127b0db1927e935c45c (diff)
downloadnixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar.gz
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar.bz2
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar.lz
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar.xz
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.tar.zst
nixlib-f0c3c54712cb7f4caf5334fbf926723a6af5d0cc.zip
Create wrapper package for fcitx with plugins.
This creates a wrapper package for fcitx so that plugins can be enabled
by the user.  This is based on the wrapper package for
pidgin-with-plugins.

By using this wrapper instead of the fcitx package itself, it will be
possible for the user to enable/disable plugins.
Diffstat (limited to 'pkgs/tools/inputmethods/fcitx')
-rw-r--r--pkgs/tools/inputmethods/fcitx/default.nix3
-rw-r--r--pkgs/tools/inputmethods/fcitx/wrapper.nix35
2 files changed, 37 insertions, 1 deletions
diff --git a/pkgs/tools/inputmethods/fcitx/default.nix b/pkgs/tools/inputmethods/fcitx/default.nix
index 28f6c97949b5..a8b3089c58ac 100644
--- a/pkgs/tools/inputmethods/fcitx/default.nix
+++ b/pkgs/tools/inputmethods/fcitx/default.nix
@@ -5,7 +5,8 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "fcitx-4.2.8.5";
+  name = "fcitx-${version}";
+  version = "4.2.8.5";
 
   src = fetchurl {
     url = "http://download.fcitx-im.org/fcitx/${name}_dict.tar.xz";
diff --git a/pkgs/tools/inputmethods/fcitx/wrapper.nix b/pkgs/tools/inputmethods/fcitx/wrapper.nix
new file mode 100644
index 000000000000..d4efb3326969
--- /dev/null
+++ b/pkgs/tools/inputmethods/fcitx/wrapper.nix
@@ -0,0 +1,35 @@
+{ stdenv, buildEnv, fcitx, makeWrapper, plugins }:
+
+# This is based on the pidgin-with-plugins package.
+# Users should be able to configure what plugins are used
+# by putting the following in their /etc/nixos/configuration.nix:
+# environment.systemPackages = with pkgs; [
+#     (fcitx-with-plugins.override { plugins = [ fcitx-anthy ]; })
+# ]
+# Or, a normal user could use it by putting the following in his
+# ~/.nixpkgs/config.nix:
+# packageOverrides = pkgs: with pkgs; rec {
+#     (fcitx-with-plugins.override { plugins = [ fcitx-anthy ]; })
+# }
+
+let
+drv = buildEnv {
+  name = "fcitx-with-plugins-" + (builtins.parseDrvName fcitx.name).version;
+
+  paths = [ fcitx ] ++ plugins;
+
+  postBuild = ''
+    # TODO: This could be avoided if buildEnv could be forced to create all directories
+    if [ -L $out/bin ]; then
+      rm $out/bin
+      mkdir $out/bin
+      for i in ${fcitx}/bin/*; do
+        ln -s $i $out/bin
+      done
+    fi
+    wrapProgram $out/bin/fcitx \
+      --set FCITXDIR "$out/"
+  '';
+  };
+in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })
+