{ config, pkgs, ... }:

{
  imports = [
    ./pulseaudio.nix
  ];

  i18n.inputMethod = {
    enabled = "ibus";
    ibus.engines = with pkgs.ibus-engines; [ mozc table-others m17n ];
  };

  environment.systemPackages = with pkgs; [
    gnome3.libgweather
    gnome3.gnome-tweak-tool
    pavucontrol
    paprefs
  ];

  fonts = {
    enableDefaultFonts = false;
    fontconfig = {
      allowBitmaps = false;
    };
    fonts = with pkgs; [
      xorg.fontbhlucidatypewriter100dpi
      xorg.fontbhlucidatypewriter75dpi
      freefont_ttf
      gyre-fonts # TrueType substitutes for standard PostScript fonts
      xorg.fontbh100dpi
      xorg.fontmiscmisc
      xorg.fontcursormisc
      unifont

      noto-fonts-emoji
      noto-fonts-cjk

      cantarell_fonts # from gnome3 module

      merriweather
      merriweather-sans
      open-sans
      # libertine # breaks 

      dejavu_fonts
      liberation_ttf
      ubuntu_font_family

      wqy_microhei
      ipafont
      ipaexfont
      source-han-serif
      source-han-sans

      inconsolata
      iosevka
      fira fira-mono fira-code
      source-code-pro

      font-awesome_5
    ];
  };

  # prevent satanic torture
  programs.qt5ct.enable = true;

  hardware.uinput.enable = true;
  users.extraUsers.gebner.extraGroups = [ "input" "tty" "audio" "video" "uinput" ];

  hardware.bluetooth = {
    enable = true;
    package = pkgs.bluezFull;
  };
  services.blueman.enable = true;

  programs.gnupg = {
    agent.enable = true;
    agent.pinentryFlavor = "gnome3";
  };

  services.xserver = {
    enable = true;
    libinput.enable = true;
    displayManager.gdm.enable = true;
    displayManager.defaultSession = "gnome";

    desktopManager.gnome3 = {
      enable = true;
    };
  };

  # rust winit's wayland support is broken for input methods
  environment.sessionVariables.WINIT_UNIX_BACKEND = "x11";

  # services.xserver.enable = true;
  # services.xserver.displayManager.gdm.enable = true;
  # services.xserver.displayManager.desktopManagerHandlesLidAndPower = false;
  # services.xserver.layout = "us";
  # services.xserver.xkbVariant = "altgr-intl";
  # services.xserver.xkbOptions = "caps:ctrl_modifier";
}