fix(power): drop TuneD for native CPU scaling (#461)

This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-10-16 16:45:08 +08:00
1 parent 643984e1ab
commit 3266aad4a2
12 files changed
+98 -46

No files matched your search

+4 -4
View File
@@ -47,10 +47,10 @@ Some tests iterate over every configuration, so a new host is covered automatica
them. Others name specific hosts — or a name prefix, like `k3s-api-endpoint`, which covers every
`k3s-test-1-*` configuration — and only cover a new host if you add it.
| Kind | Tests |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every configuration | `hostname`, `kernel`, `nix-system-features`, `security-apparmor`, `security-container-groups`, `security-exporters`, `security-firewall`, `security-k3s-kubeconfig`, `security-k3s-pod-firewall`, `security-kernel`, `security-ssh-x11` |
| Named hosts only | `btrbk`, `home-manager`, `home-manager-xdg`, `computer-use-headless`, `k3s-api-endpoint`, `k3s-node-home-manager`, `idols-ai-gpu`, `idols-ai-net`, `idols-ai-voice-input`, `idols-aquamarine`, `security-postgres-auth`, `youko-metrics`, `ups-metrics`, `shoukei-logind` |
| Kind | Tests |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every configuration | `hostname`, `kernel`, `nix-system-features`, `security-apparmor`, `security-container-groups`, `security-exporters`, `security-firewall`, `security-k3s-kubeconfig`, `security-k3s-pod-firewall`, `security-kernel`, `security-ssh-x11` |
| Named hosts only | `btrbk`, `cpu-power`, `home-manager`, `home-manager-xdg`, `computer-use-headless`, `k3s-api-endpoint`, `k3s-node-home-manager`, `idols-ai-gpu`, `idols-ai-net`, `idols-ai-voice-input`, `idols-aquamarine`, `security-postgres-auth`, `youko-metrics`, `ups-metrics`, `shoukei-logind` |
`hostname` expects each configuration's `networking.hostName` to equal its name. Niri desktop
configurations are the exception (`ai-niri` → `ai`, `shoukei-niri` → `shoukei`) and are listed in
@@ -0,0 +1,6 @@
{
governor = "schedutil";
noTuned = true;
noFrequencyCaps = true;
batteryReporting = true;
}
@@ -0,0 +1,17 @@
{
lib,
outputs,
...
}:
let
cfg = outputs.nixosConfigurations.shoukei-niri.config;
in
{
governor = cfg.powerManagement.cpuFreqGovernor;
noTuned = lib.all (host: !host.config.services.tuned.enable) (
builtins.attrValues outputs.nixosConfigurations
);
noFrequencyCaps =
cfg.powerManagement.cpufreq.min == null && cfg.powerManagement.cpufreq.max == null;
batteryReporting = cfg.services.upower.enable;
}
@@ -0,0 +1,12 @@
{
lib,
...
}:
{
governors = lib.genAttrs [ "ai-niri" "aquamarine" "shoryu" "shushou" "youko" ] (_: "powersave");
noTuned = true;
noEeeWorkaround = true;
noFrequencyCaps = true;
guestsHaveNoCpuPolicy = true;
desktopBatteryReporting = true;
}
@@ -0,0 +1,35 @@
{
lib,
outputs,
...
}:
let
configs = outputs.nixosConfigurations;
physicalHosts = [
"ai-niri"
"aquamarine"
"shoryu"
"shushou"
"youko"
];
in
{
governors = lib.genAttrs physicalHosts (
name: configs.${name}.config.powerManagement.cpuFreqGovernor
);
noTuned = lib.all (host: !host.config.services.tuned.enable) (builtins.attrValues configs);
noEeeWorkaround = lib.all (host: !(host.config.systemd.services ? disable-eee)) (
builtins.attrValues configs
);
noFrequencyCaps = lib.all (
name:
let
cfg = configs.${name}.config.powerManagement;
in
cfg.cpufreq.min == null && cfg.cpufreq.max == null
) physicalHosts;
guestsHaveNoCpuPolicy = lib.all (name: !(configs.${name}.config.systemd.services ? cpufreq)) (
lib.subtractLists physicalHosts (builtins.attrNames configs)
);
desktopBatteryReporting = configs.ai-niri.config.services.upower.enable;
}