about summary refs log tree commit diff
path: root/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos-hardware/apple/macbook-pro/12-1/default.nix')
-rw-r--r--modules/nixos-hardware/apple/macbook-pro/12-1/default.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix b/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
new file mode 100644
index 000000000000..a28ea82f8f95
--- /dev/null
+++ b/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
@@ -0,0 +1,26 @@
+{ lib, pkgs, ... }:
+
+{
+  imports = [
+    ../.
+    ../../../common/pc/laptop/ssd
+    <nixpkgs/nixos/modules/hardware/network/broadcom-43xx.nix>
+  ];
+
+  powerManagement = {
+    # Enable gradually increasing/decreasing CPU frequency, rather than using
+    # "powersave", which would keep CPU frequency at 0.8GHz.
+    cpuFreqGovernor = lib.mkDefault "conservative";
+
+    # brcmfmac being loaded during hibernation would not let a successful resume
+    # https://bugzilla.kernel.org/show_bug.cgi?id=101681#c116.
+    # Also brcmfmac could randomly crash on resume from sleep.
+    powerUpCommands = lib.mkBefore "${pkgs.kmod}/bin/modprobe brcmfmac";
+    powerDownCommands = lib.mkBefore "${pkgs.kmod}/bin/rmmod brcmfmac";
+  };
+
+  # USB subsystem wakes up MBP right after suspend unless we disable it.
+  services.udev.extraRules = lib.mkDefault ''
+    SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"
+  '';
+}