at master 1.7 kB view raw
1{ 2 config, 3 pkgs, 4 lib, 5 generators, 6 ... 7}: 8let 9 imcfg = config.i18n.inputMethod; 10in 11{ 12 imports = [ 13 (lib.mkRemovedOptionModule [ 14 "i18n" 15 "inputMethod" 16 "kime" 17 "config" 18 ] "Use i18n.inputMethod.kime.* instead") 19 ]; 20 21 options.i18n.inputMethod.kime = { 22 daemonModules = lib.mkOption { 23 type = lib.types.listOf ( 24 lib.types.enum [ 25 "Xim" 26 "Wayland" 27 "Indicator" 28 ] 29 ); 30 default = [ 31 "Xim" 32 "Wayland" 33 "Indicator" 34 ]; 35 example = [ 36 "Xim" 37 "Indicator" 38 ]; 39 description = '' 40 List of enabled daemon modules 41 ''; 42 }; 43 iconColor = lib.mkOption { 44 type = lib.types.enum [ 45 "Black" 46 "White" 47 ]; 48 default = "Black"; 49 example = "White"; 50 description = '' 51 Color of the indicator icon 52 ''; 53 }; 54 extraConfig = lib.mkOption { 55 type = lib.types.lines; 56 default = ""; 57 description = '' 58 extra kime configuration. Refer to <https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md> for details on supported values. 59 ''; 60 }; 61 }; 62 63 config = lib.mkIf (imcfg.enable && imcfg.type == "kime") { 64 i18n.inputMethod.package = pkgs.kime; 65 66 environment.variables = { 67 GTK_IM_MODULE = "kime"; 68 QT_IM_MODULE = "kime"; 69 XMODIFIERS = "@im=kime"; 70 }; 71 72 environment.etc."xdg/kime/config.yaml".text = '' 73 daemon: 74 modules: [${lib.concatStringsSep "," imcfg.kime.daemonModules}] 75 indicator: 76 icon_color: ${imcfg.kime.iconColor} 77 '' 78 + imcfg.kime.extraConfig; 79 }; 80 81 # uses attributes of the linked package 82 meta.buildDocsInSandbox = false; 83}