ibus service: refactoring

+87 -77
+52
nixos/modules/i18n/inputMethod/ibus.nix
··· 1 + { config, pkgs, lib, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.i18n.inputMethod.ibus; 7 + ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; }; 8 + ibusEngine = types.package // { 9 + name = "ibus-engine"; 10 + check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x); 11 + }; 12 + in 13 + { 14 + options = { 15 + i18n.inputMethod.ibus = { 16 + enable = mkOption { 17 + type = types.bool; 18 + default = false; 19 + example = true; 20 + description = '' 21 + Enable IBus input method. 22 + IBus can be used input of Chinese, Korean, Japanese and other special characters. 23 + ''; 24 + }; 25 + engines = mkOption { 26 + type = with types; listOf ibusEngine; 27 + default = []; 28 + example = literalExample "with pkgs.ibus-engines; [ mozc hangul ]"; 29 + description = '' 30 + Enabled IBus engines. 31 + Available engines can be found by running `nix-env "<nixpkgs>" . -qaP -A ibus-engines`. 32 + ''; 33 + }; 34 + }; 35 + }; 36 + 37 + config = mkIf cfg.enable { 38 + # Without dconf enabled it is impossible to use IBus 39 + environment.systemPackages = [ ibusPackage pkgs.gnome3.dconf ]; 40 + 41 + gtkPlugins = [ pkgs.ibus ]; 42 + qtPlugins = [ pkgs.ibus-qt ]; 43 + 44 + environment.variables = { 45 + GTK_IM_MODULE = "ibus"; 46 + QT_IM_MODULE = "ibus"; 47 + XMODIFIERS = "@im=ibus"; 48 + }; 49 + 50 + services.xserver.displayManager.sessionCommands = "${ibusPackage}/bin/ibus-daemon --daemonize --xim --cache=none"; 51 + }; 52 + }
+1 -1
nixos/modules/module-list.nix
··· 44 44 ./hardware/video/ati.nix 45 45 ./hardware/video/webcam/facetimehd.nix 46 46 ./i18n/inputMethod/fcitx.nix 47 + ./i18n/inputMethod/ibus.nix 47 48 ./installer/tools/auto-upgrade.nix 48 49 ./installer/tools/nixos-checkout.nix 49 50 ./installer/tools/tools.nix ··· 67 68 ./programs/environment.nix 68 69 ./programs/freetds.nix 69 70 ./programs/fish.nix 70 - ./programs/ibus.nix 71 71 ./programs/kbdlight.nix 72 72 ./programs/light.nix 73 73 ./programs/man.nix
-51
nixos/modules/programs/ibus.nix
··· 1 - { config, pkgs, lib, ... }: 2 - 3 - with lib; 4 - 5 - let 6 - cfg = config.programs.ibus; 7 - in 8 - { 9 - options = { 10 - 11 - programs.ibus = { 12 - enable = mkOption { 13 - type = types.bool; 14 - default = false; 15 - example = true; 16 - description = "Enable IBus input method"; 17 - }; 18 - plugins = mkOption { 19 - type = lib.types.listOf lib.types.path; 20 - default = []; 21 - description = '' 22 - IBus plugin packages 23 - ''; 24 - }; 25 - }; 26 - 27 - }; 28 - 29 - config = mkIf cfg.enable { 30 - environment.systemPackages = [ pkgs.ibus pkgs.gnome3.dconf ]; 31 - 32 - gtkPlugins = [ pkgs.ibus ]; 33 - qtPlugins = [ pkgs.ibus-qt ]; 34 - 35 - environment.variables = 36 - let 37 - env = pkgs.buildEnv { 38 - name = "ibus-env"; 39 - paths = [ pkgs.ibus ] ++ cfg.plugins; 40 - }; 41 - in { 42 - GTK_IM_MODULE = "ibus"; 43 - QT_IM_MODULE = "ibus"; 44 - XMODIFIERS = "@im=ibus"; 45 - 46 - IBUS_COMPONENT_PATH = "${env}/share/ibus/component"; 47 - }; 48 - 49 - services.xserver.displayManager.sessionCommands = "${pkgs.ibus}/bin/ibus-daemon --daemonize --xim --cache=none"; 50 - }; 51 - }
+4
nixos/modules/rename.nix
··· 59 59 # Tarsnap 60 60 (mkRenamedOptionModule [ "services" "tarsnap" "config" ] [ "services" "tarsnap" "archives" ]) 61 61 62 + # ibus 63 + (mkRenamedOptionModule [ "programs" "ibus" "enable" ] [ "i18n" "inputMethod" "ibus" "enable" ]) 64 + (mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ]) 65 + 62 66 # proxy 63 67 (mkRenamedOptionModule [ "nix" "proxy" ] [ "networking" "proxy" "default" ]) 64 68
+6 -5
pkgs/tools/inputmethods/ibus-engines/ibus-anthy/default.nix
··· 6 6 version = "1.5.8"; 7 7 8 8 meta = with stdenv.lib; { 9 - description = "IBus interface to the anthy input method"; 10 - homepage = http://wiki.github.com/fujiwarat/ibus-anthy; 11 - license = licenses.gpl2Plus; 12 - platforms = platforms.linux; 13 - maintainers = with maintainers; [ gebner ericsagnes ]; 9 + isIbusEngine = true; 10 + description = "IBus interface to the anthy input method"; 11 + homepage = http://wiki.github.com/fujiwarat/ibus-anthy; 12 + license = licenses.gpl2Plus; 13 + platforms = platforms.linux; 14 + maintainers = with maintainers; [ gebner ericsagnes ]; 14 15 }; 15 16 16 17 preConfigure = "./autogen.sh --prefix=$out";
+6 -5
pkgs/tools/inputmethods/ibus-engines/ibus-hangul/default.nix
··· 29 29 ''; 30 30 31 31 meta = with stdenv.lib; { 32 - description = "Ibus Hangul engine."; 33 - homepage = https://github.com/choehwanjin/ibus-hangul; 34 - license = licenses.gpl2; 35 - platforms = platforms.linux; 36 - maintainers = with maintainers; [ ericsagnes ]; 32 + isIbusEngine = true; 33 + description = "Ibus Hangul engine."; 34 + homepage = https://github.com/choehwanjin/ibus-hangul; 35 + license = licenses.gpl2; 36 + platforms = platforms.linux; 37 + maintainers = with maintainers; [ ericsagnes ]; 37 38 }; 38 39 }
+6 -5
pkgs/tools/inputmethods/ibus-engines/ibus-mozc/default.nix
··· 11 11 version = "2.17.2313.102"; 12 12 13 13 meta = with clangStdenv.lib; { 14 - description = "Japanese input method from Google"; 15 - homepage = http://code.google.com/p/mozc/; 16 - license = licenses.free; 17 - platforms = platforms.linux; 18 - maintainers = with maintainers; [ gebner ericsagnes ]; 14 + isIbusEngine = true; 15 + description = "Japanese input method from Google"; 16 + homepage = http://code.google.com/p/mozc/; 17 + license = licenses.free; 18 + platforms = platforms.linux; 19 + maintainers = with maintainers; [ gebner ericsagnes ]; 19 20 }; 20 21 21 22 nativeBuildInputs = [ gyp which ninja python pkgconfig ];
+6 -5
pkgs/tools/inputmethods/ibus-engines/ibus-table-others/default.nix
··· 20 20 ''; 21 21 22 22 meta = with stdenv.lib; { 23 - description = "Various table-based input methods for IBus"; 24 - homepage = https://github.com/moebiuscurve/ibus-table-others; 25 - license = licenses.gpl3; 26 - platforms = platforms.linux; 27 - maintainers = with maintainers; [ mudri ]; 23 + isIbusEngine = true; 24 + description = "Various table-based input methods for IBus"; 25 + homepage = https://github.com/moebiuscurve/ibus-table-others; 26 + license = licenses.gpl3; 27 + platforms = platforms.linux; 28 + maintainers = with maintainers; [ mudri ]; 28 29 }; 29 30 }
+6 -5
pkgs/tools/inputmethods/ibus-engines/ibus-table/default.nix
··· 12 12 buildInputs = [ ibus pkgconfig python3 pythonPackages.pygobject3 ]; 13 13 14 14 meta = with stdenv.lib; { 15 - description = "An IBus framework for table-based input methods"; 16 - homepage = https://github.com/kaio/ibus-table/wiki; 17 - license = licenses.lgpl21; 18 - platforms = platforms.linux; 19 - maintainers = with maintainers; [ mudri ]; 15 + isIbusEngine = true; 16 + description = "An IBus framework for table-based input methods"; 17 + homepage = https://github.com/kaio/ibus-table/wiki; 18 + license = licenses.lgpl21; 19 + platforms = platforms.linux; 20 + maintainers = with maintainers; [ mudri ]; 20 21 }; 21 22 }