diff --git a/hosts/t480/configuration.nix b/hosts/t480/configuration.nix index 941e944b..45c98364 100644 --- a/hosts/t480/configuration.nix +++ b/hosts/t480/configuration.nix @@ -12,14 +12,24 @@ ../../users/opdavies.nix ]; - cli.password-store = { - enable = true; + cli = { + kanata = { + enable = true; - extensions = with pkgs.passExtensions; [ - pass-audit - pass-otp - pass-update - ]; + devices = [ + "/dev/input/by-path/platform-i8042-serio-0-event-kbd" + ]; + }; + + password-store = { + enable = true; + + extensions = with pkgs.passExtensions; [ + pass-audit + pass-otp + pass-update + ]; + }; }; core = { diff --git a/modules/nixos/cli/default.nix b/modules/nixos/cli/default.nix index 5e7e09fc..1814980f 100644 --- a/modules/nixos/cli/default.nix +++ b/modules/nixos/cli/default.nix @@ -1,6 +1,7 @@ { imports = [ ./docker.nix + ./kanata.nix ./podman.nix ./password-store.nix ]; diff --git a/modules/nixos/cli/kanata.nix b/modules/nixos/cli/kanata.nix new file mode 100644 index 00000000..7b0576cf --- /dev/null +++ b/modules/nixos/cli/kanata.nix @@ -0,0 +1,59 @@ +{ config, lib, ... }: + +let + cfg = config.cli.${service}; + service = "kanata"; + + inherit (lib) mkEnableOption mkIf mkOption types; +in +{ + options.cli.${service} = { + enable = mkEnableOption "Enable ${service}"; + + devices = mkOption { + default = []; + type = types.listOf types.str; + }; + }; + + config = mkIf cfg.enable { + services.kanata = { + enable = true; + + keyboards = { + default = { + devices = cfg.devices; + + extraDefCfg = "process-unmapped-keys yes"; + + config = '' + (defsrc + caps a s d f j k l ; + ) + + (defvar + tap-time 150 + hold-time 200 + ) + + (defalias + escctrl (tap-hold 100 100 esc lctl) + a (tap-hold $tap-time $hold-time a lmet) + s (tap-hold $tap-time $hold-time s lalt) + d (tap-hold $tap-time $hold-time d lsft) + f (tap-hold $tap-time $hold-time f lctl) + j (tap-hold $tap-time $hold-time j rctl) + k (tap-hold $tap-time $hold-time k rsft) + l (tap-hold $tap-time $hold-time l ralt) + ; (tap-hold $tap-time $hold-time ; rmet) + ) + + (deflayer base + @escctrl @a @s @d @f @j @k @l @; + ) + ''; + }; + }; + }; + }; +}