diff options
Diffstat (limited to 'nixos/modules/i18n/input-method/default.nix')
-rw-r--r-- | nixos/modules/i18n/input-method/default.nix | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 3b439c4231b3f..15125ceb4a2d9 100644 --- a/nixos/modules/i18n/input-method/default.nix +++ b/nixos/modules/i18n/input-method/default.nix @@ -4,6 +4,8 @@ with lib; let cfg = config.i18n.inputMethod; + allowedTypes = types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ]; + gtk2_cache = pkgs.runCommand "gtk2-immodule.cache" { preferLocalBuild = true; allowSubstitutes = false; @@ -28,10 +30,23 @@ in { options.i18n = { inputMethod = { + enable = mkEnableOption "an additional input method type" // { + default = cfg.enabled != null; + defaultText = literalMD "`true` if the deprecated option `enabled` is set, false otherwise"; + }; + enabled = mkOption { - type = types.nullOr (types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ]); + type = types.nullOr allowedTypes; default = null; example = "fcitx5"; + description = "Deprecated - use `type` and `enable = true` instead"; + }; + + type = mkOption { + type = types.nullOr allowedTypes; + default = cfg.enabled; + defaultText = literalMD "The value of the deprecated option `enabled`, defaulting to null"; + example = "fcitx5"; description = '' Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices. @@ -59,7 +74,8 @@ in }; }; - config = mkIf (cfg.enabled != null) { + config = mkIf cfg.enable { + warnings = optional (cfg.enabled != null) "i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead"; environment.systemPackages = [ cfg.package gtk2_cache gtk3_cache ]; }; |