From 46122183b5bcda762d3df29523a9e941a72c7d5a Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sat, 18 Feb 2023 00:24:05 +0800 Subject: [PATCH] nixos/kanata: remove a limit that number of devices cannot be 0 Since 1.0.8, kanata can automatically detect keyboard devices if linux-dev is not in config. --- nixos/modules/services/hardware/kanata.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/hardware/kanata.nix b/nixos/modules/services/hardware/kanata.nix index 958eb8e402e1..e1f00b7b2eb1 100644 --- a/nixos/modules/services/hardware/kanata.nix +++ b/nixos/modules/services/hardware/kanata.nix @@ -8,8 +8,7 @@ let keyboard = { options = { devices = mkOption { - type = types.addCheck (types.listOf types.str) - (devices: (length devices) > 0); + type = types.listOf types.str; example = [ "/dev/input/by-id/usb-0000_0000-event-kbd" ]; description = mdDoc "Paths to keyboard devices."; }; @@ -71,12 +70,13 @@ let mkName = name: "kanata-${name}"; - mkDevices = devices: concatStringsSep ":" devices; + mkDevices = devices: + optionalString ((length devices) > 0) "linux-dev ${concatStringsSep ":" devices}"; mkConfig = name: keyboard: pkgs.writeText "${mkName name}-config.kdb" '' (defcfg ${keyboard.extraDefCfg} - linux-dev ${mkDevices keyboard.devices} + ${mkDevices keyboard.devices} linux-continue-if-no-devs-found yes) ${keyboard.config}