mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	apple/macbook-pro: add support for 14,1
Extracted from my system configs. There's still a few issues with this machine: 1. Audio is a lost cause. Will probably need to bribe an Apple or Cirrus engineer for the datasheet. 2. The thunderbolt module will oops upon system resume, and subsequently refuse to work until next reboot. 3. The d3cold state needs to be disabled on the NVME controller for it to wake up. 4. The Bluetooth UART (/dev/ttyS0) is created and then deleted by udev in early boot. I am yet to figure out why. Hack around it by reloading the 8250_dw module, causing it to be re-created.
This commit is contained in:
		
							
								
								
									
										51
									
								
								apple/macbook-pro/14-1/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								apple/macbook-pro/14-1/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
{ config, lib, pkgs, modulesPath, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../.
 | 
			
		||||
    ../../../common/pc/laptop/ssd
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  ##
 | 
			
		||||
  # Make the keyboard work in stage1
 | 
			
		||||
  # https://www.kernelconfig.io/config_keyboard_applespi
 | 
			
		||||
  ##
 | 
			
		||||
  boot.initrd.kernelModules = [ "applespi" "spi_pxa2xx_platform" "intel_lpss_pci" "applesmc" ];
 | 
			
		||||
 | 
			
		||||
  boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.0") pkgs.linuxPackages_latest;
 | 
			
		||||
 | 
			
		||||
  ##
 | 
			
		||||
  # Disable d3cold on the NVME controller so the machine can actually
 | 
			
		||||
  # wake up.
 | 
			
		||||
  # https://github.com/Dunedan/mbp-2016-linux
 | 
			
		||||
  ##
 | 
			
		||||
  systemd.services.disable-nvme-d3cold = {
 | 
			
		||||
    description = "Disables d3cold on the NVME controller";
 | 
			
		||||
    before      = [ "suspend.target" ];
 | 
			
		||||
    path        = [ pkgs.bash pkgs.coreutils ];
 | 
			
		||||
 | 
			
		||||
    serviceConfig.Type = "oneshot";
 | 
			
		||||
    serviceConfig.ExecStart = ./disable-nvme-d3cold.sh;
 | 
			
		||||
    serviceConfig.TimeoutSec = 0;
 | 
			
		||||
 | 
			
		||||
    wantedBy = [ "multi-user.target" "suspend.target" ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  ##
 | 
			
		||||
  # For some reason /dev/ttyS0 is created, and then removed by udev. We need this
 | 
			
		||||
  # for bluetooth, and the only way to get it again is to reload 8502_dw. Luckily,
 | 
			
		||||
  # nothing else uses it.
 | 
			
		||||
  ##
 | 
			
		||||
  systemd.services.btattach-bcm2e7c = lib.mkIf config.hardware.bluetooth.enable {
 | 
			
		||||
    before = [ "bluetooth.target" ];
 | 
			
		||||
 | 
			
		||||
    # Hacky, as it's a different device,  but this always comes after ttyS0
 | 
			
		||||
    after = [ "sys-devices-platform-serial8250-tty-ttyS1.device" ];
 | 
			
		||||
    path = [ pkgs.bash pkgs.kmod pkgs.bluez ];
 | 
			
		||||
 | 
			
		||||
    serviceConfig.Type = "simple";
 | 
			
		||||
    serviceConfig.ExecStart = ./btfix.sh;
 | 
			
		||||
 | 
			
		||||
    wantedBy = [ "multi-user.target" ];
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user