mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
i18n.inputMethod: align enable option with nixos
see: https://github.com/NixOS/nixpkgs/pull/310708
This commit is contained in:
parent
7ef3137035
commit
585bae4bbb
11 changed files with 89 additions and 23 deletions
|
|
@ -4,11 +4,18 @@
|
|||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.i18n.inputMethod;
|
||||
|
||||
allowedTypes = lib.types.enum [
|
||||
"fcitx"
|
||||
"fcitx5"
|
||||
"nabi"
|
||||
"uim"
|
||||
"hime"
|
||||
"kime"
|
||||
];
|
||||
|
||||
gtk2Cache =
|
||||
pkgs.runCommandLocal "gtk2-immodule.cache"
|
||||
{
|
||||
|
|
@ -36,7 +43,6 @@ let
|
|||
GTK_PATH=${cfg.package}/lib/gtk-3.0/ \
|
||||
gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
@ -49,19 +55,23 @@ in
|
|||
|
||||
options.i18n = {
|
||||
inputMethod = {
|
||||
enable = lib.mkEnableOption "an additional input method type" // {
|
||||
default = cfg.enabled != null;
|
||||
defaultText = lib.literalMD "`true` if the deprecated option `enabled` is set, false otherwise";
|
||||
};
|
||||
|
||||
enabled = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"fcitx"
|
||||
"fcitx5"
|
||||
"nabi"
|
||||
"uim"
|
||||
"hime"
|
||||
"kime"
|
||||
]
|
||||
);
|
||||
type = lib.types.nullOr allowedTypes;
|
||||
default = null;
|
||||
example = "fcitx5";
|
||||
description = "Deprecated - use `type` and `enable = true` instead";
|
||||
};
|
||||
|
||||
type = lib.mkOption {
|
||||
type = lib.types.nullOr allowedTypes;
|
||||
default = cfg.enabled;
|
||||
defaultText = lib.literalMD "The value of the deprecated option `enabled`, defaulting to null";
|
||||
example = "fcitx5";
|
||||
description = ''
|
||||
Select the enabled input method. Input methods are software to input
|
||||
symbols that are not available on standard input devices.
|
||||
|
|
@ -112,6 +122,10 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
warnings =
|
||||
lib.optional (cfg.enabled != null)
|
||||
"i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead";
|
||||
|
||||
home.packages = [
|
||||
cfg.package
|
||||
gtk2Cache
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (im.enabled == "fcitx5") {
|
||||
config = lib.mkIf (im.enable && im.type == "fcitx5") {
|
||||
i18n.inputMethod.package = fcitx5Package;
|
||||
|
||||
home = {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
im = config.i18n.inputMethod;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (config.i18n.inputMethod.enabled == "hime") {
|
||||
config = lib.mkIf (im.enable && im.type == "hime") {
|
||||
i18n.inputMethod.package = pkgs.hime;
|
||||
|
||||
home.sessionVariables = {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ let
|
|||
types
|
||||
;
|
||||
|
||||
im = config.i18n.inputMethod;
|
||||
cfg = config.i18n.inputMethod.kime;
|
||||
in
|
||||
{
|
||||
|
|
@ -46,7 +47,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf (config.i18n.inputMethod.enabled == "kime") {
|
||||
config = mkIf (im.enable && im.type == "kime") {
|
||||
i18n.inputMethod.package = pkgs.kime;
|
||||
|
||||
home.sessionVariables = {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
im = config.i18n.inputMethod;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (config.i18n.inputMethod.enabled == "nabi") {
|
||||
config = lib.mkIf (im.enable && im.type == "nabi") {
|
||||
i18n.inputMethod.package = pkgs.nabi;
|
||||
|
||||
home.sessionVariables = {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
let
|
||||
cfg = config.i18n.inputMethod.uim;
|
||||
im = config.i18n.inputMethod;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
@ -30,7 +31,7 @@ in
|
|||
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.i18n.inputMethod.enabled == "uim") {
|
||||
config = lib.mkIf (im.enable && im.type == "uim") {
|
||||
i18n.inputMethod.package = pkgs.uim;
|
||||
|
||||
home.sessionVariables = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue