61 lines
2 KiB
Nix
61 lines
2 KiB
Nix
{ pkgs, lib, ... }:
|
|
{
|
|
# support power features such as suspend to ram
|
|
powerManagement.enable = true;
|
|
# tune power saving options on boot
|
|
powerManagement.powertop.enable = true;
|
|
# thermald proactively prevents overheating on intel CPUs and works well with other tools
|
|
services.thermald.enable = true;
|
|
# power-profile-daemon for power management
|
|
services.power-profiles-daemon.enable = true;
|
|
# manage fans for macbook devices
|
|
services.mbpfan.enable = true;
|
|
|
|
# better performance than the actual intel driver
|
|
services.xserver.videoDrivers = [ "modesetting" ];
|
|
|
|
hardware.apple-t2.kernelChannel = "stable"; # TODO: latest is EOL? change back to latest when upd
|
|
hardware.apple-t2.firmware.enable = true;
|
|
|
|
environment.variables = {
|
|
LIBVA_DRIVER_NAME= "iHD";
|
|
VDPAU_DRIVER = "va_gl";
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [ intel-gpu-tools ];
|
|
|
|
boot.kernelParams = [
|
|
# enable the i915 sandybridge framebuffer compression (475mw savings)
|
|
"i915.enable_fbc=1"
|
|
"i915.enable_gvt=1"
|
|
];
|
|
|
|
# fix sleep/suspend
|
|
# ty https://github.com/3ulalia/flake/blob/aaddbef19979c6d952f7a763cd9e6225d6330a02/hosts/catalina/default.nix
|
|
systemd.services."suspend-fix-t2" = {
|
|
enable = true;
|
|
unitConfig = {
|
|
Description = "Disable and Re-Enable Apple BCE Module (and Wi-Fi)";
|
|
Before = "sleep.target";
|
|
StopWhenUnneeded = "yes";
|
|
};
|
|
serviceConfig = {
|
|
User = "root";
|
|
Type = "oneshot";
|
|
RemainAfterExit = "yes";
|
|
ExecStart = [
|
|
"/run/current-system/sw/bin/modprobe -r brcmfmac_wcc"
|
|
"/run/current-system/sw/bin/modprobe -r brcmfmac"
|
|
"/run/current-system/sw/bin/modprobe -r hci_bcm4377"
|
|
"/run/current-system/sw/bin/rmmod -f apple-bce"
|
|
];
|
|
ExecStop = [
|
|
"/run/current-system/sw/bin/modprobe apple-bce"
|
|
"/run/current-system/sw/bin/modprobe hci_bcm4377"
|
|
"/run/current-system/sw/bin/modprobe brcmfmac"
|
|
"/run/current-system/sw/bin/modprobe brmcfmac_wcc"
|
|
];
|
|
};
|
|
wantedBy = ["sleep.target"];
|
|
};
|
|
}
|