diff --git a/nixos/components/gui/kmonad.nix b/nixos/components/gui/kmonad.nix index 2a84faa..89ad530 100644 --- a/nixos/components/gui/kmonad.nix +++ b/nixos/components/gui/kmonad.nix @@ -1,46 +1,63 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { - services.xserver = { - layout = "us"; - xkbOptions = "compose:ralt"; + + options.components.gui.kmonad.enable = lib.mkOption { + type = lib.types.bool; + default = config.components.gui.enable; }; - services.kmonad = { - enable = true; - keyboards.dasKeyboard = { - device = "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-event-kbd"; - extraGroups = [ "video" ]; - defcfg = { - enable = true; - fallthrough = true; - allowCommands = true; - }; - config = '' - (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 cmp rctl - ) - (defalias sym (layer-toggle symbols)) + config = lib.mkIf (config.components.gui.kmonad.enable) { - (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 [ ] \ - esc a s d f g h j k l ; ' ret - lsft z x c v b n m , . / rsft - lctl lmet lalt spc @sym rmet cmp rctrl - ) - - (deflayer symbols - _ ½ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ∞ _ _ _ - _ _ _ € _ ™ _ ü _ ö _ _ _ _ - caps ä ß _ _ _ _ _ _ _ _ _ _ - _ _ _ ¢ _ _ _ _ _ _ _ _ - _ _ _ _ _ _ _ _) - ''; + services.xserver = { + layout = "us"; + xkbOptions = "compose:ralt"; }; + services.kmonad = { + enable = true; + keyboards = + let + keyboard = device: { + device = device; + extraGroups = [ "video" ]; + defcfg = { + enable = true; + fallthrough = true; + allowCommands = true; + }; + config = '' + (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 cmp rctl + ) + + (defalias sym (layer-toggle symbols)) + + (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 [ ] \ + esc a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl lmet lalt spc @sym rmet cmp rctrl + ) + + (deflayer symbols + _ ½ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ∞ _ _ _ + _ _ _ € _ ™ _ ü _ ö _ _ _ _ + caps ä ß _ _ _ _ _ _ _ _ _ _ + _ _ _ ¢ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _) + ''; + }; + + in + { + nativ = keyboard "/dev/input/by-path/platform-i8042-serio-0-event-kbd"; + dasKeyboard = keyboard "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-event-kbd"; + }; + }; }; }