diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2014-08-29 01:35:38 +0400 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2014-08-29 01:35:38 +0400 |
commit | e8badf3c3b6c3530a98a94223045822ed32f3365 (patch) | |
tree | 2729208b3530d7176b1c1629e1ee9afee229cf17 /nixos | |
parent | b6bc65ab23987515224afa75c7c01ef533d08531 (diff) | |
parent | a0c91d66f1d63192a8145e5d0314eaa701542604 (diff) | |
download | nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar.gz nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar.bz2 nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar.lz nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar.xz nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.tar.zst nixlib-e8badf3c3b6c3530a98a94223045822ed32f3365.zip |
Merge pull request #3275 from taku0/gtk-env
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.nix | 41 | ||||
-rw-r--r-- | nixos/modules/config/qt-plugin-env.nix | 37 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 3 | ||||
-rw-r--r-- | nixos/modules/programs/environment.nix | 2 | ||||
-rw-r--r-- | nixos/modules/programs/uim.nix | 29 |
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 77a14fd53863..853961804e55 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/swap.nix ./config/sysctl.nix @@ -59,6 +61,7 @@ ./programs/shell.nix ./programs/ssh.nix ./programs/ssmtp.nix + ./programs/uim.nix ./programs/venus.nix ./programs/wvdial.nix ./programs/freetds.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 &"; + }; +} |