From 470ab4f97168ce279cc898870b61753aa9cebb40 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sun, 2 Jun 2024 12:00:00 +0000 Subject: [PATCH] nixos/ibus: improve error message for non-engine packages when setting the option i18n.inputMethod.ibus.engines to a non-engine, like this: i18n.inputMethod.ibus.engines = [ pkgs.sl ]; the error message would be quite misleading: error: A definition for option `nodes.machine.i18n.inputMethod.ibus.engines."[definition 1-entry 1]"' is not of type `package'. Definition values: - In `makeTest parameters': sl is rejected and yet it *is* a package. This change improves the error message to this: error: A definition for option `nodes.machine.i18n.inputMethod.ibus.engines."[definition 1-entry 1]"' is not of type `ibus-engine'. Definition values: - In `makeTest parameters': --- nixos/modules/i18n/input-method/ibus.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix index c82f0099253b..c44c86823599 100644 --- a/nixos/modules/i18n/input-method/ibus.nix +++ b/nixos/modules/i18n/input-method/ibus.nix @@ -5,8 +5,9 @@ with lib; let cfg = config.i18n.inputMethod.ibus; ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; }; - ibusEngine = types.package // { + ibusEngine = lib.types.mkOptionType { name = "ibus-engine"; + inherit (lib.types.package) descriptionClass merge; check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x); };