| 
									
										
										
										
											2016-02-16 23:10:46 +09:00
										 |  |  | { config, pkgs, lib, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  | let | 
					
						
							|  |  |  |   cfg = config.i18n.inputMethod; | 
					
						
							| 
									
										
										
										
											2016-09-27 15:26:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   gtk2_cache = pkgs.runCommand "gtk2-immodule.cache" | 
					
						
							|  |  |  |     { preferLocalBuild = true; | 
					
						
							|  |  |  |       allowSubstitutes = false; | 
					
						
							|  |  |  |       buildInputs = [ pkgs.gtk2 cfg.package ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     ''
 | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  |       mkdir -p $out/etc/gtk-2.0/ | 
					
						
							|  |  |  |       GTK_PATH=${cfg.package}/lib/gtk-2.0/ gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache | 
					
						
							|  |  |  |     '';
 | 
					
						
							| 
									
										
										
										
											2016-09-27 15:26:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   gtk3_cache = pkgs.runCommand "gtk3-immodule.cache" | 
					
						
							|  |  |  |     { preferLocalBuild = true; | 
					
						
							|  |  |  |       allowSubstitutes = false; | 
					
						
							|  |  |  |       buildInputs = [ pkgs.gtk3 cfg.package ]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     ''
 | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  |       mkdir -p $out/etc/gtk-3.0/ | 
					
						
							|  |  |  |       GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache | 
					
						
							|  |  |  |     '';
 | 
					
						
							| 
									
										
										
										
											2016-09-27 15:26:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  | in | 
					
						
							| 
									
										
										
										
											2016-02-16 23:10:46 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  |   options.i18n = { | 
					
						
							|  |  |  |     inputMethod = { | 
					
						
							| 
									
										
										
										
											2016-02-16 23:10:46 +09:00
										 |  |  |       enabled = mkOption { | 
					
						
							|  |  |  |         type    = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]); | 
					
						
							|  |  |  |         default = null; | 
					
						
							|  |  |  |         example = "fcitx"; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Input methods are specially used to input Chinese, Japanese and Korean characters. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Currently the following input methods are available in NixOS: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           <itemizedlist> | 
					
						
							|  |  |  |           <listitem><para>ibus: The intelligent input bus, extra input engines can be added using <literal>i18n.inputMethod.ibus.engines</literal>.</para></listitem> | 
					
						
							|  |  |  |           <listitem><para>fcitx: A customizable lightweight input method, extra input engines can be added using <literal>i18n.inputMethod.fcitx.engines</literal>.</para></listitem> | 
					
						
							|  |  |  |           <listitem><para>nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5.</para></listitem> | 
					
						
							|  |  |  |           <listitem><para>uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean.</para></listitem> | 
					
						
							|  |  |  |           </itemizedlist> | 
					
						
							|  |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  |       package = mkOption { | 
					
						
							|  |  |  |         internal = true; | 
					
						
							| 
									
										
										
										
											2018-07-09 20:37:27 +00:00
										 |  |  |         type     = types.nullOr types.path; | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  |         default  = null; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							|  |  |  |           The input method method package. | 
					
						
							|  |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2016-02-16 23:10:46 +09:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2016-04-04 18:11:20 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  |   config = mkIf (cfg.enabled != null) { | 
					
						
							|  |  |  |     environment.systemPackages = [ cfg.package gtk2_cache gtk3_cache ]; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-09 14:53:27 +09:00
										 |  |  |   meta = { | 
					
						
							|  |  |  |     maintainers = with lib.maintainers; [ ericsagnes ]; | 
					
						
							|  |  |  |     doc = ./default.xml; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-16 23:10:46 +09:00
										 |  |  | } |