dotfiles/modules/os/misc/laptop.nix
eriedaberrie c2380dad7b Initial commit
Note: not the actual initial commit.

I swear I will stop repeatedly force pushing to this single commit eventually
ok.
2024-09-21 00:45:42 -07:00

50 lines
1.4 KiB
Nix

{ config, lib, ... }:
let
cfg = config.my.laptop;
in {
options.my.laptop = {
enable = lib.mkEnableOption null;
amd.enable = lib.mkEnableOption null;
intel.enable = lib.mkEnableOption null;
};
config = lib.mkIf cfg.enable {
boot.kernel.sysctl."vm.dirty_writeback_centisecs" = 1500;
boot.extraModprobeConfig = ''
options snd_hda_intel power_save=1
'';
services.upower.enable = true;
services.power-profiles-daemon.enable = cfg.amd.enable;
services.tlp = lib.mkIf cfg.intel.enable {
enable = true;
settings = {
DISK_IDLE_SECS_ON_AC = 0;
DISK_IDLE_SECS_ON_BAT = 3;
MAX_LOST_WORK_SECS_ON_AC = 15;
MAX_LOST_WORK_SECS_ON_BAT = 45;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 25;
INTEL_GPU_MIN_FREQ_ON_AC = 300;
INTEL_GPU_MIN_FREQ_ON_BAT = 300;
INTEL_GPU_MAX_FREQ_ON_AC = 1100;
INTEL_GPU_MAX_FREQ_ON_BAT = 1000;
INTEL_GPU_BOOST_FREQ_ON_AC = 1100;
INTEL_GPU_BOOST_FREQ_ON_BAT = 1000;
PCIE_ASPM_ON_AC = "default";
PCIE_ASPM_ON_BAT = "powersave";
};
};
};
}