diff --git a/nixos/configurations/Tytonidae/default.nix b/nixos/configurations/Tytonidae/default.nix index 40228fe..bfaa93b 100644 --- a/nixos/configurations/Tytonidae/default.nix +++ b/nixos/configurations/Tytonidae/default.nix @@ -30,6 +30,7 @@ openssh.enable = true; steam.enable = true; tailscale.enable = true; + kanata.enable = true; }; gui.enabled = "cosmic"; }; diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index b587be2..9d0487f 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -24,6 +24,7 @@ ./gui ./steam.nix ./tailscale.nix + ./kanata.nix ]; config = { diff --git a/nixos/modules/kanata.nix b/nixos/modules/kanata.nix new file mode 100644 index 0000000..0437c2a --- /dev/null +++ b/nixos/modules/kanata.nix @@ -0,0 +1,52 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.youthlic.programs.kanata; +in +{ + options = { + youthlic.programs.kanata = { + enable = lib.mkEnableOption "kanata"; + }; + }; + config = lib.mkIf cfg.enable { + boot.kernelModules = [ "uinput" ]; + hardware.uinput.enable = true; + services.kanata = { + enable = true; + package = pkgs.kanata-with-cmd; + keyboards.default = { + extraDefCfg = '' + process-unmapped-keys no + ''; + config = '' + #| + Kanata + + CapsLock tap to Esc + CapsLock hold to Ctrl + |# + ;; default keyboard layout + (defsrc + caps ;; type → esc, hold caps → ctrl + esc ;; type esc → caps, hold esc → esc + ) + + (deflayer default + @cac + @esc-behavior + ) + + (defalias + cac (tap-hold 190 190 esc lctrl) ;; hold CapsLock → Esc, press CapsLock → LCtrl + esc-behavior (tap-hold 190 190 caps esc) ;; hold Esc → CapsLock, press Esc → Esc + ) + ''; + }; + }; + }; +}