summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2016-02-26 17:30:20 -0600
committerThomas Tuegel <ttuegel@gmail.com>2016-02-26 18:08:48 -0600
commitf058f1c1d3a265766cf5e74678758f253d2c6f15 (patch)
treebb0cd6108eaddd7d216d9178ea365d1268ca4048 /pkgs
parent10e3664c97e8de4b1719db38c2cd9db2500bd1af (diff)
downloadnixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar.gz
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar.bz2
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar.lz
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar.xz
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.tar.zst
nixlib-f058f1c1d3a265766cf5e74678758f253d2c6f15.zip
ibus-with-plugins: rewrite wrapper
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/tools/inputmethods/ibus/wrapper.nix50
1 files changed, 31 insertions, 19 deletions
diff --git a/pkgs/tools/inputmethods/ibus/wrapper.nix b/pkgs/tools/inputmethods/ibus/wrapper.nix
index 270a2db7412c..3bccad1cc0c9 100644
--- a/pkgs/tools/inputmethods/ibus/wrapper.nix
+++ b/pkgs/tools/inputmethods/ibus/wrapper.nix
@@ -1,24 +1,36 @@
-{ stdenv, buildEnv, ibus, makeWrapper, plugins, hicolor_icon_theme }:
+{ stdenv, runCommand, ibus, lndir, makeWrapper, plugins, hicolor_icon_theme }:
 
 let
-drv = buildEnv {
   name = "ibus-with-plugins-" + (builtins.parseDrvName ibus.name).version;
+  env = {
+    nativeBuildInputs = [ lndir makeWrapper ];
+    propagatedUserEnvPackages = [ hicolor_icon_theme ];
+    paths = [ ibus ] ++ plugins;
+  };
+  command = ''
+    for dir in bin etc lib libexec share; do
+        mkdir -p "$out/$dir"
+        for pkg in $paths; do
+            if [ -d "$pkg/$dir" ]; then
+                lndir -silent "$pkg/$dir" "$out/$dir"
+            fi
+        done
+    done
 
-  paths = [ ibus hicolor_icon_theme ] ++ 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 ${ibus}/bin/*; do
-        ln -s $i $out/bin
-      done
-    fi
-    wrapProgram $out/bin/ibus \
-      --set IBUS_COMPONENT_PATH "$out/share/ibus/component/"
-    wrapProgram $out/bin/ibus-daemon \
-      --set IBUS_COMPONENT_PATH "$out/share/ibus/component/"
+    for prog in ibus ibus-daemon ibus-setup; do
+        wrapProgram "$out/bin/$prog" \
+          --suffix XDG_DATA_DIRS : "${hicolor_icon_theme}/share" \
+          --set IBUS_COMPONENT_PATH "$out/share/ibus/component/" \
+          --set IBUS_DATAROOTDIR "$out/share" \
+          --set IBUS_LIBEXECDIR "$out/libexec" \
+          --set IBUS_LOCALEDIR "$out/share/locale" \
+          --set IBUS_PREFIX "$out" \
+          --set IBUS_TABLE_BIN_PATH "$out/bin" \
+          --set IBUS_TABLE_DATA_DIR "$out/share" \
+          --set IBUS_TABLE_LIB_LOCATION "$out/libexec" \
+          --set IBUS_TABLE_LOCATION "$out/share/ibus-table" \
+          --set IBUS_TABLE_DEBUG_LEVEL 1
+    done
   '';
-  };
-in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })
+in
+  runCommand name env command