From 847adc7d631070f5561e402da604e1d37e5f435e Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 3 Jan 2026 20:09:39 +0800 Subject: [PATCH] feat: add power management service --- hosts/12kingdoms-shoukei/default.nix | 1 + hosts/idols-ai/default.nix | 1 + modules/nixos/desktop/power.nix | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 modules/nixos/desktop/power.nix diff --git a/hosts/12kingdoms-shoukei/default.nix b/hosts/12kingdoms-shoukei/default.nix index ae1c2146..030e8fd5 100644 --- a/hosts/12kingdoms-shoukei/default.nix +++ b/hosts/12kingdoms-shoukei/default.nix @@ -19,6 +19,7 @@ in # disable sunshine for securrity services.sunshine.enable = lib.mkForce false; + services.tuned.ppdSettings.main.default = lib.mkForce "power-saver"; networking = { inherit hostName; diff --git a/hosts/idols-ai/default.nix b/hosts/idols-ai/default.nix index ea731885..1f57bfc9 100644 --- a/hosts/idols-ai/default.nix +++ b/hosts/idols-ai/default.nix @@ -25,6 +25,7 @@ in ]; services.sunshine.enable = lib.mkForce true; + services.tuned.ppdSettings.main.default = lib.mkForce "performance"; networking = { inherit hostName; diff --git a/modules/nixos/desktop/power.nix b/modules/nixos/desktop/power.nix new file mode 100644 index 00000000..646f3620 --- /dev/null +++ b/modules/nixos/desktop/power.nix @@ -0,0 +1,17 @@ +{ ... }: +{ + # TuneD - Tuning Profile Delivery Mechanism for Linux + # A modern replacement for PPD(power-profiles-daemon) + services.tuned = { + enable = true; + settings.dynamic_tuning = true; + ppdSupport = true; # translation of power-profiles-daemon API calls to TuneD + ppdSettings.main.default = "balanced"; # balanced / performance / power-saver + }; + # DBus service that provides power management support to applications + # Required by `tuned-ppd` for handling power supply changes + services.upower.enable = true; + + services.power-profiles-daemon.enable = false; # conflicts with tuned + services.tlp.enable = false; # conflicts with tuned +}