1{ stdenv, buildEnv, fcitx, makeWrapper, plugins }:
2
3# This is based on the pidgin-with-plugins package.
4# Users should be able to configure what plugins are used
5# by putting the following in their /etc/nixos/configuration.nix:
6# environment.systemPackages = with pkgs; [
7# (fcitx-with-plugins.override { plugins = [ fcitx-anthy ]; })
8# ]
9# Or, a normal user could use it by putting the following in his
10# ~/.nixpkgs/config.nix:
11# packageOverrides = pkgs: with pkgs; rec {
12# (fcitx-with-plugins.override { plugins = [ fcitx-anthy ]; })
13# }
14
15let
16drv = buildEnv {
17 name = "fcitx-with-plugins-" + (builtins.parseDrvName fcitx.name).version;
18
19 paths = [ fcitx ] ++ plugins;
20
21 postBuild = ''
22 # TODO: This could be avoided if buildEnv could be forced to create all directories
23 if [ -L $out/bin ]; then
24 rm $out/bin
25 mkdir $out/bin
26 for i in ${fcitx}/bin/*; do
27 ln -s $i $out/bin
28 done
29 fi
30 wrapProgram $out/bin/fcitx \
31 --set FCITXDIR "$out/"
32 '';
33 };
34in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })
35