From f7b50c397770431da55462f941a081dcd7d5f9f3 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Tue, 7 May 2024 00:41:03 +0800 Subject: [PATCH 1/3] nixos/kanata: improve example of the package option Before this patch, it is rendered as "Example: kanata-with-cmd". With this patch applied, it is "Example: pkgs.kanata-with-cmd". --- nixos/modules/services/hardware/kanata.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/hardware/kanata.nix b/nixos/modules/services/hardware/kanata.nix index 333b2d2a88a5..bf5bfa7b2e2b 100644 --- a/nixos/modules/services/hardware/kanata.nix +++ b/nixos/modules/services/hardware/kanata.nix @@ -153,7 +153,7 @@ in options.services.kanata = { enable = mkEnableOption "kanata, a tool to improve keyboard comfort and usability with advanced customization"; package = mkPackageOption pkgs "kanata" { - example = "kanata-with-cmd"; + example = [ "kanata-with-cmd" ]; extraDescription = '' ::: {.note} If {option}`danger-enable-cmd` is enabled in any of the keyboards, the From 4eafe1458d481569d1b7736c53eece2b65143b1a Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Tue, 7 May 2024 00:51:40 +0800 Subject: [PATCH 2/3] nixos/kanata: improve links to the upstream documentation --- 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 bf5bfa7b2e2b..ad40c646ea85 100644 --- a/nixos/modules/services/hardware/kanata.nix +++ b/nixos/modules/services/hardware/kanata.nix @@ -5,6 +5,8 @@ with lib; let cfg = config.services.kanata; + upstreamDoc = "See [the upstream documentation](https://github.com/jtroo/kanata/blob/main/docs/config.adoc) and [example config files](https://github.com/jtroo/kanata/tree/main/cfg_samples) for more information."; + keyboard = { options = { devices = mkOption { @@ -42,8 +44,7 @@ let description = '' Configuration other than `defcfg`. - See [example config files](https://github.com/jtroo/kanata) - for more information. + ${upstreamDoc} ''; }; extraDefCfg = mkOption { @@ -55,8 +56,7 @@ let from the devices option) and `linux-continue-if-no-devs-found` (hardcoded to be yes). - See [example config files](https://github.com/jtroo/kanata) - for more information. + ${upstreamDoc} ''; }; extraArgs = mkOption { From 75a864edf1e78ecb75860ad6366b8984e36e5736 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Tue, 7 May 2024 01:23:31 +0800 Subject: [PATCH 3/3] nixos/kanata: replace deflayer with deflayermap in config example IMHO, this style is more intuitive. --- nixos/modules/services/hardware/kanata.nix | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/nixos/modules/services/hardware/kanata.nix b/nixos/modules/services/hardware/kanata.nix index ad40c646ea85..c7e0e93baf6e 100644 --- a/nixos/modules/services/hardware/kanata.nix +++ b/nixos/modules/services/hardware/kanata.nix @@ -24,22 +24,11 @@ let type = types.lines; example = '' (defsrc - grv 1 2 3 4 5 6 7 8 9 0 - = bspc - tab q w e r t y u i o p [ ] \ - caps a s d f g h j k l ; ' ret - lsft z x c v b n m , . / rsft - lctl lmet lalt spc ralt rmet rctl) + caps) - (deflayer qwerty - grv 1 2 3 4 5 6 7 8 9 0 - = bspc - tab q w e r t y u i o p [ ] \ - @cap a s d f g h j k l ; ' ret - lsft z x c v b n m , . / rsft - lctl lmet lalt spc ralt rmet rctl) - - (defalias - ;; tap within 100ms for capslk, hold more than 100ms for lctl - cap (tap-hold 100 100 caps lctl)) + (deflayermap (default-layer) + ;; tap caps lock as caps lock, hold caps lock as left control + caps (tap-hold 100 100 caps lctl)) ''; description = '' Configuration other than `defcfg`.