diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 15125ceb4a2d..a706b045e377 100644 --- a/nixos/modules/i18n/input-method/default.nix +++ b/nixos/modules/i18n/input-method/default.nix @@ -1,10 +1,8 @@ { config, pkgs, lib, ... }: - -with lib; let cfg = config.i18n.inputMethod; - allowedTypes = types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ]; + allowedTypes = lib.types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ]; gtk2_cache = pkgs.runCommand "gtk2-immodule.cache" { preferLocalBuild = true; @@ -30,22 +28,22 @@ in { options.i18n = { inputMethod = { - enable = mkEnableOption "an additional input method type" // { + enable = lib.mkEnableOption "an additional input method type" // { default = cfg.enabled != null; - defaultText = literalMD "`true` if the deprecated option `enabled` is set, false otherwise"; + defaultText = lib.literalMD "`true` if the deprecated option `enabled` is set, false otherwise"; }; - enabled = mkOption { - type = types.nullOr allowedTypes; + enabled = lib.mkOption { + type = lib.types.nullOr allowedTypes; default = null; example = "fcitx5"; description = "Deprecated - use `type` and `enable = true` instead"; }; - type = mkOption { - type = types.nullOr allowedTypes; + type = lib.mkOption { + type = lib.types.nullOr allowedTypes; default = cfg.enabled; - defaultText = literalMD "The value of the deprecated option `enabled`, defaulting to null"; + defaultText = lib.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. @@ -63,9 +61,9 @@ in ''; }; - package = mkOption { + package = lib.mkOption { internal = true; - type = types.nullOr types.path; + type = lib.types.nullOr lib.types.path; default = null; description = '' The input method method package. @@ -74,8 +72,8 @@ in }; }; - 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"; + config = lib.mkIf cfg.enable { + warnings = lib.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 ]; };