{ 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 ─────────────────────── # Closing the lid suspends, even on AC — Duet 3 is a tablet, treat it like one. # Short press on power: suspend (matches ChromeOS/iOS); long press: poweroff. # The DMS bar power menu is the way to reboot / shut down explicitly. 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; }