-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac-things.nix
60 lines (48 loc) · 1.4 KB
/
mac-things.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{config, pkgs, ...}:
{
# IDK If these things work yet fr, but fuck it we ball
hardware.facetimehd.enable = true;
services.logind.extraConfig = ''
HandlePowerKey=suspend-then-hibernate
HandlePowerKeyLongPress=poweroff
HandleLidSwitch=suspend-then-hibernate
HandleLidSwitchExternalPower=suspend-then-hibernate
HandleLidSwitchDocked=suspend-then-hibernate
HoldoffTimeoutSec=5s
IdleAction=suspend
IdleActionSec=300s
'';
# Potential fix to mac not resuming on wake up
systemd.services.disable-d3cold = {
enable = false;
description = "Disable D3cold for PCI device 0000:01:00.0";
serviceConfig.Type = "oneshot";
script = ''
echo 0 > /sys/bus/pci/devices/0000:01:00.0/d3cold_allowed
'';
wantedBy = [ "multi-user.target" ];
};
systemd.services.disable-nvme-d3cold = {
enable = true;
description = "Disable d3cold for NVMe to fix suspend issues";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/echo 0 > /sys/bus/pci/devices/0000:01:00.0/d3cold_allowed";
RemainAfterExit = true;
};
};
services.logind = {
lidSwitch = "suspend";
};
services.mbpfan = {
enable = true;
aggressive = false;
settings.general = {
low_temp = 50;
high_temp = 55;
max_temp = 65;
};
};
}