Files
dotfiles/hosts/doloro-laptop/laptop.nix

78 lines
2.3 KiB
Nix

{ pkgs, lib, ... }:
let
in
{
services.tlp = {
enable = true;
settings = {
CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_SAV = "power";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
PCIE_ASPM_ON_BAT = "powersave";
CPU_SCALING_GOVERNOR_ON_AC = "balanced";
PCIE_ASPM_ON_AC = "balanced";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
CPU_BOOST_ON_SAV = 0;
CPU_HWP_DYN_BOOST_ON_AC = 1;
CPU_HWP_DYN_BOOST_ON_BAT = 0;
CPU_HWP_DYN_BOOST_ON_SAV = 0;
PLATFORM_PROFILE_ON_AC = "balanced";
PLATFORM_PROFILE_ON_BAT = "quiet";
PLATFORM_PROFILE_ON_SAV = "quiet";
START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
# services.tuned.enable = true;
services.thermald.enable = true;
services.upower = {
enable = true;
};
boot.kernelParams = [
# "mem_sleep_default=deep"
"i915.fastboot=1"
"pcie_aspm=force"
"ahci.mobile_lpm_policy=1"
];
services.logind.settings.Login = {
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
HandleLidSwitchDocked = "ignore";
};
systemd.sleep.extraConfig = ''
HibernateDelaySec=30min
SuspendEstimationSec=120
'';
# one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", "suspend-then-hibernate", "lock"
powerManagement = {
enable = true;
# powertop.enable = true;
};
systemd.user.services.rfkill-sleep = {
# I haven't tested this, but in theory, disabling rf devices before sleep will save on power
enable = true;
before = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; disables all rf devices before sleeping. useful for saving power";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill block all'';
};
};
systemd.user.services.rfkill-wake = {
enable = true;
after = [ "systemd-suspend.service" ];
wantedBy = [ "default.target" ];
description = "Using rfkill; enable all rf devices after sleeping.";
serviceConfig = {
Type = "simple";
ExecStart = ''${pkgs.utillinux}/bin/rfkill unblock all'';
};
};
}