mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/i18n.inputMethod.ibus: remove with lib;
This commit is contained in:
parent
17c011592a
commit
3eb92bcce7
1 changed files with 14 additions and 17 deletions
|
@ -1,7 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
imcfg = config.i18n.inputMethod;
|
imcfg = config.i18n.inputMethod;
|
||||||
cfg = imcfg.ibus;
|
cfg = imcfg.ibus;
|
||||||
|
@ -9,10 +6,10 @@ let
|
||||||
ibusEngine = lib.types.mkOptionType {
|
ibusEngine = lib.types.mkOptionType {
|
||||||
name = "ibus-engine";
|
name = "ibus-engine";
|
||||||
inherit (lib.types.package) descriptionClass merge;
|
inherit (lib.types.package) descriptionClass merge;
|
||||||
check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x);
|
check = x: (lib.types.package.check x) && (lib.attrByPath ["meta" "isIbusEngine"] false x);
|
||||||
};
|
};
|
||||||
|
|
||||||
impanel = optionalString (cfg.panel != null) "--panel=${cfg.panel}";
|
impanel = lib.optionalString (cfg.panel != null) "--panel=${cfg.panel}";
|
||||||
|
|
||||||
ibusAutostart = pkgs.writeTextFile {
|
ibusAutostart = pkgs.writeTextFile {
|
||||||
name = "autostart-ibus-daemon";
|
name = "autostart-ibus-daemon";
|
||||||
|
@ -29,32 +26,32 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
|
(lib.mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
|
||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
i18n.inputMethod.ibus = {
|
i18n.inputMethod.ibus = {
|
||||||
engines = mkOption {
|
engines = lib.mkOption {
|
||||||
type = with types; listOf ibusEngine;
|
type = with lib.types; listOf ibusEngine;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
|
example = lib.literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
|
||||||
description =
|
description =
|
||||||
let
|
let
|
||||||
enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines;
|
enginesDrv = lib.filterAttrs (lib.const lib.isDerivation) pkgs.ibus-engines;
|
||||||
engines = concatStringsSep ", "
|
engines = lib.concatStringsSep ", "
|
||||||
(map (name: "`${name}`") (attrNames enginesDrv));
|
(map (name: "`${name}`") (lib.attrNames enginesDrv));
|
||||||
in "Enabled IBus engines. Available engines are: ${engines}.";
|
in "Enabled IBus engines. Available engines are: ${engines}.";
|
||||||
};
|
};
|
||||||
panel = mkOption {
|
panel = lib.mkOption {
|
||||||
type = with types; nullOr path;
|
type = with lib.types; nullOr path;
|
||||||
default = null;
|
default = null;
|
||||||
example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
|
example = lib.literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
|
||||||
description = "Replace the IBus panel with another panel.";
|
description = "Replace the IBus panel with another panel.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (imcfg.enable && imcfg.type == "ibus") {
|
config = lib.mkIf (imcfg.enable && imcfg.type == "ibus") {
|
||||||
i18n.inputMethod.package = ibusPackage;
|
i18n.inputMethod.package = ibusPackage;
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
|
@ -76,7 +73,7 @@ in
|
||||||
XMODIFIERS = "@im=ibus";
|
XMODIFIERS = "@im=ibus";
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.portal.extraPortals = mkIf config.xdg.portal.enable [
|
xdg.portal.extraPortals = lib.mkIf config.xdg.portal.enable [
|
||||||
ibusPackage
|
ibusPackage
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue