{ pkgs, ... }: {
  imports = [ ./xingyao-audio ];

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.videoDrivers = [
    # "nvidia"
    # default video drivers
    "radeon" "nouveau" "modesetting" "fbdev"
    "modesetting" "amdgpu"
  ];

  # Cosmic
  # * Cons
  #   * bluetooth cannot disable auto connect,
  #     and no one discussed in comsic-applets/comsic-epoch github issues
  #   * dont have enough key binding settings
  #     * E.g. left/right half screen?
  # services.desktopManager.cosmic.enable = true;
  # services.displayManager.cosmic-greeter.enable = true;
  # services.desktopManager.gnome.enable = true;
  # services.displayManager.gdm.enable = true;
  # greetd delegates its PAM stack to login.
  security.pam.services.login.enableGnomeKeyring = true;
  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = toString [
          "${pkgs.tuigreet}/bin/tuigreet"
          "--time" "--asterisks" "--remember"
          # Use niri-session instead of niri --session.
          # niri-session is a NixOS wrapper that properly initializes the systemd user
          # session, including activating graphical-session.target. Without this, portal
          # services like xdg-desktop-portal-gnome fail to start (dependency failed), which
          # causes xdg-desktop-portal to hang during D-Bus auto-start. GTK4 apps query
          # org.freedesktop.portal.Desktop during startup and block for ~25s waiting for a
          # reply that never comes, resulting in ~1 minute startup delays (e.g. gnome-characters).
          "--cmd 'niri-session'"
        ];
      };
    };
  };

  # Configure keymap in X11
  # services.xserver.layout = "us";
  # services.xserver.xkbOptions = "eurosign:e";

  # Enable CUPS to print documents.
  # https://nixos.wiki/wiki/Printing
  services.printing.enable = true;
  services.printing.drivers = [pkgs.hplip];
  services.avahi.enable = true;
  services.avahi.nssmdns4 = true;

  # Enable touchpad support (enabled default in most desktopManager).
  services.libinput.enable = true;

  nixpkgs.config.allowUnfree = true;

  services.gpm.enable = true;

  hardware.xone.enable = true;

  # for x11 gesture
  services.touchegg.enable = true;

  # for DMS to persist user avatar via AccountsService
  services.accounts-daemon.enable = true;
}