68 lines · 2.2 KB
{...}: {
  services.asusd.enable = true;

  # Freeze workaround.
  boot.kernelParams = ["amdgpu.cwsr_enable=0"];

  # Suspend-drain fix.
  boot.extraModprobeConfig = ''
    options mt7925e disable_aspm=1
  '';

  # Mark the ASUS ROG Flow Z13 (GZ302EA) detachable touchpad as internal
  # so libinput enables disable-while-typing. The touchpad connects over
  # USB and would otherwise be treated as external.
  services.udev.extraHwdb = ''
    touchpad:usb:v0b05p1a30:*
     ID_INPUT_TOUCHPAD_INTEGRATION=internal
  '';

  # Suspend on lid close. Logind's HandleLidSwitch doesn't work reliably
  # with Wayland sessions, so acpid triggers a oneshot service instead.
  services.logind.settings.Login = {
    HandleLidSwitch = "ignore";
    HandleLidSwitchExternalPower = "ignore";
    HandleLidSwitchDocked = "ignore";
  };

  systemd.services.lid-suspend = {
    description = "Suspend on lid close";
    wantedBy = ["acpid.service"];
    after = ["acpid.service"];
    serviceConfig.Type = "oneshot";
    script = "systemctl suspend";
  };

  services.acpid = {
    enable = true;
    handlers.lid-close = {
      event = "button/lid.*close";
      action = "systemctl start lid-suspend.service";