68 lines
1.8 KiB
Nix
68 lines
1.8 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
let
|
|
cfg = config.grimmShared;
|
|
in
|
|
{
|
|
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
|
|
environment.systemPackages = with pkgs; [
|
|
acpi
|
|
lm_sensors
|
|
lshw
|
|
pciutils
|
|
usbutils
|
|
powertop
|
|
# tlpui
|
|
];
|
|
|
|
services.ddccontrol.enable = true;
|
|
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
|
|
hardware.i2c.enable = true;
|
|
services.xserver.libinput.enable = true;
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
|
|
|
boot = {
|
|
kernelParams = [
|
|
"splash"
|
|
"quiet"
|
|
"intel_iommu=on"
|
|
"iommu=force"
|
|
"pcie_acs_override=downstream"
|
|
"mmio_stale_data=full,nosmt"
|
|
"pcie_aspm=off"
|
|
]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
|
|
kernelModules = [ "kvm-intel" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ];
|
|
blacklistedKernelModules = [ "i2c_nvidia_gpu" ];
|
|
};
|
|
|
|
services.power-profiles-daemon.enable = false;
|
|
# powerManagement.powertop.enable = true;
|
|
|
|
services.upower.enable = true;
|
|
|
|
services.tlp = {
|
|
enable = true;
|
|
settings = {
|
|
USB_AUTOSUSPEND = 1;
|
|
USB_EXCLUDE_BTUSB = 1;
|
|
USB_EXCLUDE_PHONE = 1;
|
|
SOUND_POWER_SAVE_ON_AC = 0;
|
|
SOUND_POWER_SAVE_ON_BAT = 1;
|
|
SATA_LINKPWR_ON_AC = "max_performance";
|
|
SATA_LINKPWR_ON_BAT = "min_power";
|
|
MAX_LOST_WORK_SECS_ON_BAT = 15;
|
|
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
|
|
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
|
CPU_BOOST_ON_AC = 1;
|
|
CPU_BOOST_ON_BAT = 0;
|
|
RUNTIME_PM_ON_AC = "on";
|
|
RUNTIME_PM_ON_BAT = "auto";
|
|
};
|
|
};
|
|
};
|
|
|
|
options.grimmShared.laptop_hardware = {
|
|
enable = lib.mkEnableOption "grimm-laptop";
|
|
};
|
|
|
|
}
|