mirror of
https://github.com/thegeneralist01/config.git
synced 2026-10-09 21:03:30 +02:00
nixos: reduce idle power usage
This commit is contained in:
parent
e0bddc241c
commit
f32139af2c
2 changed files with 41 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, modulesPath, ... }:
|
{ config, lib, modulesPath, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
|
|
@ -23,6 +23,33 @@
|
||||||
boot.kernelParams = [ "usbcore.autosuspend=-1" ];
|
boot.kernelParams = [ "usbcore.autosuspend=-1" ];
|
||||||
networking.networkmanager.wifi.powersave = false;
|
networking.networkmanager.wifi.powersave = false;
|
||||||
|
|
||||||
|
# Favor efficient idle and light-load operation without suspending this
|
||||||
|
# always-on host. The EPP setting retains short performance bursts.
|
||||||
|
powerManagement = {
|
||||||
|
cpuFreqGovernor = "powersave";
|
||||||
|
scsiLinkPolicy = "med_power_with_dipm";
|
||||||
|
};
|
||||||
|
systemd.services.energy-policy = {
|
||||||
|
description = "Apply host energy policy";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "systemd-modules-load.service" "local-fs.target" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = ''
|
||||||
|
for policy in /sys/devices/system/cpu/cpufreq/policy*; do
|
||||||
|
if [ -w "$policy/energy_performance_preference" ]; then
|
||||||
|
echo balance_power > "$policy/energy_performance_preference"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# This unmounted archival HDD wakes transparently when accessed.
|
||||||
|
disk=/dev/disk/by-id/ata-ST1000DM010-2EP102_ZN1043CH
|
||||||
|
if [ -b "$disk" ]; then
|
||||||
|
${pkgs.hdparm}/bin/hdparm -S 120 "$disk"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
boot.kernel.sysctl."kernel.nmi_watchdog" = 0;
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
{
|
{
|
||||||
device = "/dev/disk/by-label/NIXROOT";
|
device = "/dev/disk/by-label/NIXROOT";
|
||||||
|
|
@ -42,6 +69,7 @@
|
||||||
options = [
|
options = [
|
||||||
"nofail"
|
"nofail"
|
||||||
"x-systemd.automount"
|
"x-systemd.automount"
|
||||||
|
"noatime"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,18 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Blank displays without suspending the machine or its services.
|
||||||
|
services.swayidle = {
|
||||||
|
enable = true;
|
||||||
|
timeouts = [{
|
||||||
|
timeout = 600;
|
||||||
|
command = "${pkgs.niri}/bin/niri msg action power-off-monitors";
|
||||||
|
resumeCommand = "${pkgs.niri}/bin/niri msg action power-on-monitors";
|
||||||
|
}];
|
||||||
|
events.before-sleep =
|
||||||
|
"${pkgs.niri}/bin/niri msg action power-off-monitors";
|
||||||
|
};
|
||||||
|
|
||||||
programs.niri = {
|
programs.niri = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.niri;
|
package = pkgs.niri;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue