58 lines
2.1 KiB
Nix
58 lines
2.1 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
|
|
# see: https://github.com/GnomedDev/T2FanRD/blob/5b1c0c10785b8e8dfe124a4d6aaa7c2becdac65c/src/config.rs#L62
|
|
services.mbpfan.enable = false;
|
|
services.t2fanrd.enable = true;
|
|
services.t2fanrd.config.Fan1 = {
|
|
low_temp = 55;
|
|
high_temp = 75;
|
|
speed_curve = "linear";
|
|
always_full_speed = false;
|
|
};
|
|
|
|
# replace basic t2 kernel with cachyos kernel
|
|
# same patches and i trust it to be more up to date (one time the "latest" was EOL for t2,,,)
|
|
# also interesting how this supports l4 but my big computer doesn't...
|
|
boot.kernelPackages = lib.mkForce pkgs.cachyosKernels.linuxPackages-cachyos-latest-lto-x86_64-v4;
|
|
|
|
# fix wifi firmware
|
|
hardware.apple-t2.firmware.enable = true;
|
|
|
|
# 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"];
|
|
};
|
|
}
|