mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 15:51:54 -05:00
hardware/laptop: revert to power-profiles-daemon by default
This commit is contained in:
parent
fb7780e043
commit
9aa5390da7
|
@ -3,11 +3,29 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
|
||||||
|
current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
|
||||||
|
if [ "$current_profile" == "power-saver" ]; then
|
||||||
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set balanced
|
||||||
|
elif [ "$current_profile" == "balanced" ]; then
|
||||||
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set performance
|
||||||
|
elif [ "$current_profile" == "performance" ]; then
|
||||||
|
${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set power-saver
|
||||||
|
fi
|
||||||
|
new_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
|
||||||
|
${lib.getExe pkgs.libnotify} "Power profile set to $new_profile."
|
||||||
|
'';
|
||||||
|
in {
|
||||||
config = lib.mkIf config.ar.hardware.laptop {
|
config = lib.mkIf config.ar.hardware.laptop {
|
||||||
|
environment.systemPackages =
|
||||||
|
lib.optional (config.services.power-profiles-daemon.enable)
|
||||||
|
pp-adjuster;
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
power-profiles-daemon.enable = lib.mkDefault false;
|
power-profiles-daemon.enable = true;
|
||||||
upower.enable = true;
|
upower.enable = true;
|
||||||
|
|
||||||
tlp = {
|
tlp = {
|
||||||
enable = !config.services.power-profiles-daemon.enable;
|
enable = !config.services.power-profiles-daemon.enable;
|
||||||
settings = {
|
settings = {
|
||||||
|
|
Loading…
Reference in a new issue