{user}: {
  lib,
  pkgs,
  config,
  ...
}:
with lib; {
  options.keyboard = {
    dvorak = {
      enable = mkEnableOption "use a good keyboard layout on a qwerty keyboard";
    };
  };

  config = {
    home-manager.users.${user}.imports = [
      {
        wayland.windowManager.hyprland = {
          settings = {
            input = {
              kb_layout = "gb";
              kb_options = "caps:escape";
              numlock_by_default = true;
            };
            # moonlander is programmed in dvorak!
            "device:zsa-technology-labs-moonlander-mark-i" = {
              kb_variant = "";
              kb_options = "esperanto:qwerty,lv3:ralt_switch";
            };
          };
        };
      }
    ];
    services.xserver.xkbVariant =
      if config.keyboard.dvorak.enable
      then "dvorak"
      else "";
  };
}
