{ pkgs, ... }: { # ─────────────────────── Power & thermal ─────────────────────── # Snapdragon 7c (sc7180) on a tablet form factor: aim for battery life. `schedutil` is the # right modern cpufreq governor on ARM (responsive + power-aware); use it instead of # `powersave` to avoid pinning the CPU at minimum frequency under interactive load. powerManagement.cpuFreqGovernor = "schedutil"; powerManagement.enable = true; # ─────────────────────── logind: lid & power button ─────────────────────── # Tablet form factor: lid close = suspend (even on AC), short power-press = suspend, long # power-press = poweroff. Niri's own power-key handler must stay disabled — see the # `input.disable-power-key-handling` flag in `_private/touch-tablet.nix` — otherwise niri's # `block` inhibitor on `handle-power-key` pre-empts logind and turns the wake-from-suspend # press (which the EC re-delivers as KEY_POWER) into an immediate re-suspend loop # (https://github.com/niri-wm/niri/issues/2233). services.logind.settings.Login = { HandleLidSwitch = "suspend"; HandleLidSwitchExternalPower = "suspend"; HandleLidSwitchDocked = "ignore"; HandlePowerKey = "suspend"; HandlePowerKeyLongPress = "poweroff"; }; # ─────────────────────── Idle / suspend tuning ─────────────────────── # Allow suspend-to-RAM but disable hibernate (ARM swap-resume is unreliable, and we don't # have a swap device by default anyway). systemd.sleep.settings.Sleep = { AllowHibernation = "no"; AllowHybridSleep = "no"; AllowSuspendThenHibernate = "no"; }; # upower picks the right battery percentages for low/critical out of the box; just make # sure the action on critical is hibernate-then-poweroff fallback (we disabled hibernate # so it'll go straight to poweroff). DMS reads upower for the bar widget. services.upower = { enable = true; criticalPowerAction = "PowerOff"; percentageLow = 15; percentageCritical = 7; percentageAction = 3; }; # ─────────────────────── Bluetooth audio quality of life ─────────────────────── # Duet has limited mic/speaker hw — keep wpa_supplicant power-save off so audio doesn't crackle # over Bluetooth when CPU is idle. (Wi-Fi + BT share the chip; aggressive power-save = stutter.) networking.networkmanager.wifi.powersave = false; }