From 93d292b8306e09a0273eb09eeee957f316b72be8 Mon Sep 17 00:00:00 2001 From: Rehno Lindeque Date: Sun, 22 Jul 2018 17:22:08 -0400 Subject: [PATCH 1/5] apple/macbook-pro/11-5: init --- README.org | 1 + apple/macbook-pro/11-5/README.wiki | 8 ++++++++ apple/macbook-pro/11-5/default.nix | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 apple/macbook-pro/11-5/README.wiki create mode 100644 apple/macbook-pro/11-5/default.nix diff --git a/README.org b/README.org index ce0dcb0..1ed22ee 100644 --- a/README.org +++ b/README.org @@ -23,6 +23,7 @@ should look like: | Apple MacBook Air 4,X | ~~ | | Apple MacBook Air 6,X | ~~ | | [[file:apple/macbook-pro/10-1][Apple MacBook Pro 10,1]] | ~~ | +| [[file:apple/macbook-pro/11-5][Apple MacBook Pro 11,5]] | ~~ | | Apple MacBook Pro 12,1 | ~~ | | [[file:dell/xps/15-9550][Dell XPS 15 9550]] | ~~ | | [[file:inversepath/usbarmory][Inverse Path USB armory]] | ~~ | diff --git a/apple/macbook-pro/11-5/README.wiki b/apple/macbook-pro/11-5/README.wiki new file mode 100644 index 0000000..6e1e8a8 --- /dev/null +++ b/apple/macbook-pro/11-5/README.wiki @@ -0,0 +1,8 @@ += Apple MacBook Pro 11,5 = + +This configuration will '''not''' work with MacBook Pro 11,2 or 11,3 models. + +The [https://support.apple.com/kb/SP719 MacBookPro11,4 and MacBookPro11,5] models ship with a discrete ATI graphics card (whereas MacBookPro11,2 and MacBookPro11,3 ship with NVidia cards). This is alongside the usual integrated Intel GPU. + +You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it. + diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix new file mode 100644 index 0000000..b5c36a6 --- /dev/null +++ b/apple/macbook-pro/11-5/default.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../common/pc/laptop/ssd + + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Apparently this is currently only supported by ati_unfree drivers, not ati + hardware.opengl.driSupport32Bit = false; + + services.xserver.videoDrivers = [ "ati" ]; +} From ec4c3da28964fa585f8be62e0d69536cdc0ad6a3 Mon Sep 17 00:00:00 2001 From: Rehno Lindeque Date: Sun, 22 Jul 2018 21:46:04 -0400 Subject: [PATCH 2/5] apple/macbook-pro/11-5: Additional wiki resources As suggested by issue #41. --- apple/macbook-pro/11-5/README.wiki | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apple/macbook-pro/11-5/README.wiki b/apple/macbook-pro/11-5/README.wiki index 6e1e8a8..a5070ea 100644 --- a/apple/macbook-pro/11-5/README.wiki +++ b/apple/macbook-pro/11-5/README.wiki @@ -6,3 +6,7 @@ The [https://support.apple.com/kb/SP719 MacBookPro11,4 and MacBookPro11,5] model You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it. +== Additional resources == + +* Arch linux wiki: [https://wiki.archlinux.org/index.php/MacBookPro11,x MacBookPro11,x] +* Kernel patches: [https://bugzilla.kernel.org/buglist.cgi?quicksearch=macbookpro11 MacBookPro11,x] From e31b17512822fb7be589ee3701621413a36b1c64 Mon Sep 17 00:00:00 2001 From: Rehno Lindeque Date: Sat, 28 Jul 2018 13:01:50 -0400 Subject: [PATCH 3/5] apple/macbook-pro/11-5: Change README to markdown .wiki is just plain distracting to edit, markdown allows me to quickly write up accompanying docs. --- apple/macbook-pro/11-5/README.md | 12 ++++++++++++ apple/macbook-pro/11-5/README.wiki | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 apple/macbook-pro/11-5/README.md delete mode 100644 apple/macbook-pro/11-5/README.wiki diff --git a/apple/macbook-pro/11-5/README.md b/apple/macbook-pro/11-5/README.md new file mode 100644 index 0000000..49ddc4a --- /dev/null +++ b/apple/macbook-pro/11-5/README.md @@ -0,0 +1,12 @@ +# Apple MacBook Pro 11,5 + +This configuration will **not** work with MacBook Pro 11,2 or 11,3 models. + +The [MacBookPro11,4 and MacBookPro11,5](https://support.apple.com/kb/SP719) models ship with a discrete ATI graphics card (whereas MacBookPro11,2 and MacBookPro11,3 ship with NVidia cards). This is alongside the usual integrated Intel GPU. + +You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it. + +## Additional resources + +* Arch linux wiki: [MacBookPro11,x](https://wiki.archlinux.org/index.php/MacBookPro11,x) +* Kernel patches: [MacBookPro11,x](https://bugzilla.kernel.org/buglist.cgi?quicksearch=macbookpro11) diff --git a/apple/macbook-pro/11-5/README.wiki b/apple/macbook-pro/11-5/README.wiki deleted file mode 100644 index a5070ea..0000000 --- a/apple/macbook-pro/11-5/README.wiki +++ /dev/null @@ -1,12 +0,0 @@ -= Apple MacBook Pro 11,5 = - -This configuration will '''not''' work with MacBook Pro 11,2 or 11,3 models. - -The [https://support.apple.com/kb/SP719 MacBookPro11,4 and MacBookPro11,5] models ship with a discrete ATI graphics card (whereas MacBookPro11,2 and MacBookPro11,3 ship with NVidia cards). This is alongside the usual integrated Intel GPU. - -You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it. - -== Additional resources == - -* Arch linux wiki: [https://wiki.archlinux.org/index.php/MacBookPro11,x MacBookPro11,x] -* Kernel patches: [https://bugzilla.kernel.org/buglist.cgi?quicksearch=macbookpro11 MacBookPro11,x] From 694fd85397db316fdf18b7cf23bcbbdee2e84a67 Mon Sep 17 00:00:00 2001 From: Rehno Lindeque Date: Sat, 28 Jul 2018 13:41:15 -0400 Subject: [PATCH 4/5] apple/macbookpro/11-5: Prevent intermittent xhci wakeup after suspend --- apple/macbook-pro/11-5/README.md | 20 ++++++++++++++++++++ apple/macbook-pro/11-5/default.nix | 15 ++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/apple/macbook-pro/11-5/README.md b/apple/macbook-pro/11-5/README.md index 49ddc4a..17e5ef1 100644 --- a/apple/macbook-pro/11-5/README.md +++ b/apple/macbook-pro/11-5/README.md @@ -2,6 +2,26 @@ This configuration will **not** work with MacBook Pro 11,2 or 11,3 models. +## Notable features + +* Prevent intermittent USB 3.0 controller wakeup signal when the lid is closed. Without this fix your laptop may get very hot and drain the battery after waking up in your laptop bag. + + You can see for yourself which devices are allowed to wake up your laptop using the command: + + ```shell + cat /proc/acpi/wakeup + ``` + + This fix works for Linux kernel 3.13 and above. + + Sources: + + * [Fix unwanted laptop resume after lid is closed](https://medium.com/@laurynas.karvelis_95228/install-arch-linux-on-macbook-pro-11-2-retina-install-guide-for-year-2017-2034ceed4cb2#66ba) + * [Arch wiki: MacBookPro11,x Suspend](https://wiki.archlinux.org/index.php/MacBookPro11,x#Suspend) + * [simonvandel/dotfiles (nix config)](https://github.com/simonvandel/dotfiles/blob/f254a4a607257faee295ce798ed215273c342850/nixos/vandel-macair/configuration.nix#L45) + +## Graphics + The [MacBookPro11,4 and MacBookPro11,5](https://support.apple.com/kb/SP719) models ship with a discrete ATI graphics card (whereas MacBookPro11,2 and MacBookPro11,3 ship with NVidia cards). This is alongside the usual integrated Intel GPU. You may wish to look into dynamic switching between integrated and discrete graphics, but this config doesn't attempt it. diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix index b5c36a6..28ce18c 100644 --- a/apple/macbook-pro/11-5/default.nix +++ b/apple/macbook-pro/11-5/default.nix @@ -1,4 +1,10 @@ -{ lib, pkgs, ... }: +{ lib, config, pkgs, ... }: + +let + + kernelPackages = config.boot.kernelPackages; + +in { imports = [ @@ -14,4 +20,11 @@ hardware.opengl.driSupport32Bit = false; services.xserver.videoDrivers = [ "ati" ]; + + services.udev.extraRules = + # Disable XHC1 wakeup signal to avoid resume getting triggered some time + # after suspend. Reboot required for this to take effect. + lib.optionalString + (lib.versionAtLeast kernelPackages.kernel.version "3.13") + ''SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"''; } From a9f65b889655b0730935d6754fb64926fce42bf4 Mon Sep 17 00:00:00 2001 From: Rehno Lindeque Date: Mon, 30 Jul 2018 14:04:59 -0400 Subject: [PATCH 5/5] apple/macbook-pro/11-5: Remove boot loader Since the boot loader is already automatically generated by nixos-generate-config, there is no need to include it here. --- apple/macbook-pro/11-5/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/apple/macbook-pro/11-5/default.nix b/apple/macbook-pro/11-5/default.nix index 28ce18c..a53b5d8 100644 --- a/apple/macbook-pro/11-5/default.nix +++ b/apple/macbook-pro/11-5/default.nix @@ -13,9 +13,6 @@ in ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - # Apparently this is currently only supported by ati_unfree drivers, not ati hardware.opengl.driSupport32Bit = false;