about summary refs log tree commit diff
path: root/modules/nixos-hardware/apple/macbook-pro/12-1
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-02-27 02:57:35 +0000
committerAlyssa Ross <hi@alyssa.is>2021-02-27 03:02:31 +0000
commitab630003f4951542d7f246f25c11a19dc718bb64 (patch)
treef62eee9a6e91ad9d6ce6a62d68facd23c3c36dbe /modules/nixos-hardware/apple/macbook-pro/12-1
parent7eb57d645ab60d8e61911c1aebc221cc2b9d98f8 (diff)
parent115770eed0c0fa50c1277cd0f7fe0f15501dbc43 (diff)
downloadnixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar.gz
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar.bz2
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar.lz
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar.xz
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.tar.zst
nixlib-ab630003f4951542d7f246f25c11a19dc718bb64.zip
modules/nixos-hardware: merge 115770eed0c
Diffstat (limited to 'modules/nixos-hardware/apple/macbook-pro/12-1')
-rw-r--r--modules/nixos-hardware/apple/macbook-pro/12-1/README.md15
-rw-r--r--modules/nixos-hardware/apple/macbook-pro/12-1/default.nix14
2 files changed, 28 insertions, 1 deletions
diff --git a/modules/nixos-hardware/apple/macbook-pro/12-1/README.md b/modules/nixos-hardware/apple/macbook-pro/12-1/README.md
new file mode 100644
index 000000000000..6618dc9e5723
--- /dev/null
+++ b/modules/nixos-hardware/apple/macbook-pro/12-1/README.md
@@ -0,0 +1,15 @@
+# MacBook Pro 12,1
+
+## Wireless won't get reconnected after resume/hibernate
+
+The wifi driver is unloaded before suspend/hibernate to workaround driver issues.
+This means it might be required to restart your wifi deamon i.e. wpa_supplicant:
+
+```nix
+powerManagement.powerUpCommands = ''
+  ${pkgs.systemd}/bin/systemctl restart wpa_supplicant.service
+'';
+};
+```
+
+You can apply this to your network management software of choice.
diff --git a/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix b/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
index 02c6f328cf5a..a28ea82f8f95 100644
--- a/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
+++ b/modules/nixos-hardware/apple/macbook-pro/12-1/default.nix
@@ -1,4 +1,4 @@
-{ lib, ... }:
+{ lib, pkgs, ... }:
 
 {
   imports = [
@@ -7,6 +7,18 @@
     <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"