summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authortaku0 <mxxouy6x3m_github@tatapa.org>2014-07-13 15:46:34 +0900
committertaku0 <mxxouy6x3m_github@tatapa.org>2014-07-14 21:33:05 +0900
commita0c91d66f1d63192a8145e5d0314eaa701542604 (patch)
tree1706306045ac384f7a6f257b5369cfa9180875d9 /nixos
parentd2e731e111d6be3be7c25d237214e862fab4ca5d (diff)
downloadnixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar.gz
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar.bz2
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar.lz
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar.xz
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.tar.zst
nixlib-a0c91d66f1d63192a8145e5d0314eaa701542604.zip
uim, gtk-exe-env, qt-plugin-env: Add input method modules for GTK+ and Qt
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/gtk-exe-env.nix41
-rw-r--r--nixos/modules/config/qt-plugin-env.nix37
-rw-r--r--nixos/modules/module-list.nix3
-rw-r--r--nixos/modules/programs/environment.nix2
-rw-r--r--nixos/modules/programs/uim.nix29
5 files changed, 111 insertions, 1 deletions
diff --git a/nixos/modules/config/gtk-exe-env.nix b/nixos/modules/config/gtk-exe-env.nix
new file mode 100644
index 000000000000..b565072e3a71
--- /dev/null
+++ b/nixos/modules/config/gtk-exe-env.nix
@@ -0,0 +1,41 @@
+{ config, pkgs, lib, ... }:
+
+{
+  imports = [
+  ];
+
+  options = {
+    gtkPlugins = lib.mkOption {
+      type = lib.types.listOf lib.types.path;
+      default = [];
+      description = ''
+        Plugin packages for GTK+ such as input methods.
+      '';
+    };
+  };
+
+  config = {
+    environment.variables = if builtins.length config.gtkPlugins > 0
+      then
+        let
+          paths = [ pkgs.gtk2 pkgs.gtk3 ] ++ config.gtkPlugins;
+          env = pkgs.buildEnv {
+            name = "gtk-exe-env";
+
+            inherit paths;
+
+            postBuild = lib.concatStringsSep "\n"
+              (map (d: d.gtkExeEnvPostBuild or "") paths);
+
+            ignoreCollisions = true;
+          };
+        in {
+          GTK_EXE_PREFIX = builtins.toString env;
+          GTK_PATH = [
+            "${env}/lib/gtk-2.0"
+            "${env}/lib/gtk-3.0"
+          ];
+        }
+      else {};
+  };
+}
diff --git a/nixos/modules/config/qt-plugin-env.nix b/nixos/modules/config/qt-plugin-env.nix
new file mode 100644
index 000000000000..c59865604165
--- /dev/null
+++ b/nixos/modules/config/qt-plugin-env.nix
@@ -0,0 +1,37 @@
+{ config, pkgs, lib, ... }:
+
+{
+  imports = [
+  ];
+
+  options = {
+    qtPlugins = lib.mkOption {
+      type = lib.types.listOf lib.types.path;
+      default = [];
+      description = ''
+        Plugin packages for Qt such as input methods.
+      '';
+    };
+  };
+
+  config = {
+    environment.variables = if builtins.length config.qtPlugins > 0
+      then
+        let
+          paths = [ pkgs.qt48 ] ++ config.qtPlugins;
+          env = pkgs.buildEnv {
+            name = "qt-plugin-env";
+
+            inherit paths;
+
+            postBuild = lib.concatStringsSep "\n"
+              (map (d: d.qtPluginEnvPostBuild or "") paths);
+
+            ignoreCollisions = true;
+          };
+        in {
+          QT_PLUGIN_PATH = [ (builtins.toString env) ];
+        }
+      else {};
+  };
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index a9039eea71d4..74f4eebd619c 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -5,6 +5,7 @@
   ./config/fonts/fonts.nix
   ./config/fonts/ghostscript.nix
   ./config/gnu.nix
+  ./config/gtk-exe-env.nix
   ./config/i18n.nix
   ./config/krb5.nix
   ./config/ldap.nix
@@ -13,6 +14,7 @@
   ./config/nsswitch.nix
   ./config/power-management.nix
   ./config/pulseaudio.nix
+  ./config/qt-plugin-env.nix
   ./config/shells-environment.nix
   ./config/system-environment.nix
   ./config/swap.nix
@@ -56,6 +58,7 @@
   ./programs/shell.nix
   ./programs/ssh.nix
   ./programs/ssmtp.nix
+  ./programs/uim.nix
   ./programs/venus.nix
   ./programs/wvdial.nix
   ./programs/zsh/zsh.nix
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index 80c3e83fe812..4a510805b019 100644
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@ -52,7 +52,7 @@ in
         STRIGI_PLUGIN_PATH = [ "${i}/lib/strigi/" ];
         QT_PLUGIN_PATH = [ "${i}/lib/qt4/plugins" "${i}/lib/kde4/plugins" ];
         QTWEBKIT_PLUGIN_PATH = [ "${i}/lib/mozilla/plugins/" ];
-        GTK_PATH = [ "${i}/lib/gtk-2.0" ];
+        GTK_PATH = [ "${i}/lib/gtk-2.0" "${i}/lib/gtk-3.0" ];
         XDG_CONFIG_DIRS = [ "${i}/etc/xdg" ];
         XDG_DATA_DIRS = [ "${i}/share" ];
         MOZ_PLUGIN_PATH = [ "${i}/lib/mozilla/plugins" ];
diff --git a/nixos/modules/programs/uim.nix b/nixos/modules/programs/uim.nix
new file mode 100644
index 000000000000..237da3415dc3
--- /dev/null
+++ b/nixos/modules/programs/uim.nix
@@ -0,0 +1,29 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+  cfg = config.uim;
+in
+{
+  options = {
+    uim = {
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        example = true;
+        description = "enable UIM input method";
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.systemPackages = [ pkgs.uim ];
+    gtkPlugins = [ pkgs.uim ];
+    qtPlugins = [ pkgs.uim ];
+    environment.variables.GTK_IM_MODULE = "uim";
+    environment.variables.QT_IM_MODULE = "uim";
+    environment.variables.XMODIFIERS = "@im=uim";
+    services.xserver.displayManager.sessionCommands = "uim-xim &";
+  };
+}