nixos-config/nixos/components/gui/kmonad.nix
2023-06-11 14:31:49 +02:00

69 lines
2.6 KiB
Nix

{ config, pkgs, lib, ... }:
{
options.components.gui.kmonad.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
config = lib.mkIf (config.components.gui.kmonad.enable) {
# only needed if you have an UHK
hardware.keyboard.uhk.enable = true;
environment.systemPackages = [ pkgs.unstable.uhk-agent ];
users.users.mainUser.extraGroups = [ "input" ];
services.xserver = {
layout = "us";
xkbOptions = "compose:ralt";
};
services.kmonad = {
enable = true;
keyboards =
let
keyboard = device: leftOfSpace: {
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
${lib.concatStringsSep " " leftOfSpace} 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 lalt lmet spc @sym rmet cmp rctrl
)
(deflayer symbols
_ ½ ² ³ _ _ _
_ _ _ _ _ ü _ ö _ _ _ _
caps ä ß _ _ _ _ _ _ _ _ _ _
_ _ _ ¢ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _)
'';
};
in
{
nativ = keyboard "/dev/input/by-path/platform-i8042-serio-0-event-kbd" [ "lctl" "lmet" "lalt" ];
dasKeyboard = keyboard "/dev/input/by-id/usb-Metadot_-_Das_Keyboard_Das_Keyboard-event-kbd" [ "lctl" "lmet" "lalt" ];
uhk = keyboard "/dev/input/by-id/usb-Ultimate_Gadget_Laboratories_UHK_60_v2-if01-event-kbd" [ "lctl" "lalt" "lmet" ];
};
};
};
}