nixos/input-method: deprecate .enabled option; add .type and .enable options

This commit introduces two new properties:
`enable` and `type`, to replace the `enabled` property.
`enable` has the same meaning as is common across nixpkgs.
`type` has the same meaning as the existing `enabled` property.
`enabled` property is now deprecated and will be removed in a future release.

Fixes #180654

GY bcc7eff2 d253e9a9

Changed files
+60 -21
doc
packages
nixos
doc
manual
release-notes
modules
tests
installed-tests
+2 -1
doc/packages/ibus.section.md
···
```nix
{ pkgs, ... }: {
i18n.inputMethod = {
-
enabled = "ibus";
+
enable = true;
+
type = "ibus";
ibus.engines = with pkgs.ibus-engines; [ typing-booster ];
};
}
+3
nixos/doc/manual/release-notes/rl-2411.section.md
···
The derivation now installs "impl" headers selectively instead of by a wildcard.
Use `imgui.src` if you just want to access the unpacked sources.
+
- The `i18n.inputMethod` module introduces two new properties:
+
`enable` and `type`, for declaring whether to enable an alternative input method and defining which input method respectfully. The options available in `type` are the same as the existing `enabled` option. `enabled` is now deprecated, and will be removed in a future release.
+
- `security.pam.u2f` now follows RFC42.
All module options are now settable through the freeform `.settings`.
+12 -6
nixos/modules/i18n/input-method/default.md
···
```nix
{
i18n.inputMethod = {
-
enabled = "ibus";
+
enable = true;
+
type = "ibus";
ibus.engines = with pkgs.ibus-engines; [ anthy hangul mozc ];
};
}
···
```nix
{
i18n.inputMethod = {
-
enabled = "fcitx5";
+
enable = true;
+
type = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-mozc fcitx5-hangul fcitx5-m17n ];
};
}
···
```nix
{
i18n.inputMethod = {
-
enabled = "nabi";
+
enable = true;
+
type = "nabi";
};
}
```
···
```nix
{
i18n.inputMethod = {
-
enabled = "uim";
+
enable = true;
+
type = "uim";
};
}
```
···
```nix
{
i18n.inputMethod = {
-
enabled = "hime";
+
enable = true;
+
type = "hime";
};
}
```
···
```nix
{
i18n.inputMethod = {
-
enabled = "kime";
+
enable = true;
+
type = "kime";
};
}
```
+18 -2
nixos/modules/i18n/input-method/default.nix
···
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;
···
{
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.
···
};
};
-
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 ];
};
+3 -3
nixos/modules/i18n/input-method/fcitx5.nix
···
with lib;
let
-
im = config.i18n.inputMethod;
-
cfg = im.fcitx5;
+
imcfg = config.i18n.inputMethod;
+
cfg = imcfg.fcitx5;
fcitx5Package =
if cfg.plasma6Support
then pkgs.qt6Packages.fcitx5-with-addons.override { inherit (cfg) addons; }
···
'')
];
-
config = mkIf (im.enabled == "fcitx5") {
+
config = mkIf (imcfg.enable && imcfg.type == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;
i18n.inputMethod.fcitx5.addons = lib.optionals (cfg.quickPhrase != { }) [
+5 -1
nixos/modules/i18n/input-method/hime.nix
···
{ config, pkgs, lib, ... }:
with lib;
+
+
let
+
imcfg = config.i18n.inputMethod;
+
in
{
-
config = mkIf (config.i18n.inputMethod.enabled == "hime") {
+
config = mkIf (imcfg.enable && imcfg.type == "hime") {
i18n.inputMethod.package = pkgs.hime;
environment.variables = {
GTK_IM_MODULE = "hime";
+3 -2
nixos/modules/i18n/input-method/ibus.nix
···
with lib;
let
-
cfg = config.i18n.inputMethod.ibus;
+
imcfg = config.i18n.inputMethod;
+
cfg = imcfg.ibus;
ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; };
ibusEngine = types.package // {
name = "ibus-engine";
···
};
};
-
config = mkIf (config.i18n.inputMethod.enabled == "ibus") {
+
config = mkIf (imcfg.enable && imcfg.type == "ibus") {
i18n.inputMethod.package = ibusPackage;
environment.systemPackages = [
+3 -2
nixos/modules/i18n/input-method/kime.nix
···
{ config, pkgs, lib, generators, ... }:
-
let imcfg = config.i18n.inputMethod;
+
let
+
imcfg = config.i18n.inputMethod;
in {
imports = [
(lib.mkRemovedOptionModule [ "i18n" "inputMethod" "kime" "config" ] "Use i18n.inputMethod.kime.* instead")
···
};
};
-
config = lib.mkIf (imcfg.enabled == "kime") {
+
config = lib.mkIf (imcfg.enable && imcfg.type == "kime") {
i18n.inputMethod.package = pkgs.kime;
environment.variables = {
+4 -1
nixos/modules/i18n/input-method/nabi.nix
···
{ config, pkgs, lib, ... }:
with lib;
+
let
+
imcfg = config.i18n.inputMethod;
+
in
{
-
config = mkIf (config.i18n.inputMethod.enabled == "nabi") {
+
config = mkIf (imcfg.enable && imcfg.type == "nabi") {
i18n.inputMethod.package = pkgs.nabi;
environment.variables = {
+3 -2
nixos/modules/i18n/input-method/uim.nix
···
with lib;
let
-
cfg = config.i18n.inputMethod.uim;
+
imcfg = config.i18n.inputMethod;
+
cfg = imcfg.uim;
in
{
options = {
···
};
-
config = mkIf (config.i18n.inputMethod.enabled == "uim") {
+
config = mkIf (imcfg.enable && imcfg.type == "uim") {
i18n.inputMethod.package = pkgs.uim;
environment.variables = {
+4 -1
nixos/tests/installed-tests/ibus.nix
···
testConfig = {
i18n.supportedLocales = [ "all" ];
-
i18n.inputMethod.enabled = "ibus";
+
i18n.inputMethod = {
+
enable = true;
+
type = "ibus";
+
};
systemd.user.services.ibus-daemon = {
serviceConfig.ExecStart = "${pkgs.ibus}/bin/ibus-daemon --xim --verbose";
wantedBy = [ "graphical-session.target" ];