mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand
 | 
						|
, ... } @ args:
 | 
						|
 | 
						|
let
 | 
						|
  version = "6.11";
 | 
						|
  majorVersion = with lib; (elemAt (take 1 (splitVersion version)) 0);
 | 
						|
 | 
						|
  patchRepo = fetchFromGitHub {
 | 
						|
    owner = "t2linux";
 | 
						|
    repo = "linux-t2-patches";
 | 
						|
    rev = "54b4f914930d92cf0b94601b402ec93f54a76390";
 | 
						|
    hash = "sha256-mpGWcx+zE5kb5USE4CPGrrleZRNGxVUGxc9eQY5IIfY=";
 | 
						|
  };
 | 
						|
 | 
						|
  kernel = fetchzip {
 | 
						|
    url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
 | 
						|
    hash = "sha256-QIbHTLWI5CaStQmuoJ1k7odQUDRLsWNGY10ek0eKo8M=";
 | 
						|
  };
 | 
						|
in
 | 
						|
buildLinux (args // {
 | 
						|
  inherit version;
 | 
						|
 | 
						|
  pname = "linux-t2";
 | 
						|
  # Snippet from nixpkgs
 | 
						|
  modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}";
 | 
						|
 | 
						|
  src = runCommand "patched-source" {} ''
 | 
						|
    cp -r ${kernel} $out
 | 
						|
    chmod -R u+w $out
 | 
						|
    cd $out
 | 
						|
    while read -r patch; do
 | 
						|
      echo "Applying patch $patch";
 | 
						|
      patch -p1 < $patch;
 | 
						|
    done < <(find ${patchRepo} -type f -name "*.patch" | sort)
 | 
						|
  '';
 | 
						|
 | 
						|
  structuredExtraConfig = with lib.kernel; {
 | 
						|
    APPLE_BCE = module;
 | 
						|
    APPLE_GMUX = module;
 | 
						|
    APFS_FS = module;
 | 
						|
    BRCMFMAC = module;
 | 
						|
    BT_BCM = module;
 | 
						|
    BT_HCIBCM4377 = module;
 | 
						|
    BT_HCIUART_BCM = yes;
 | 
						|
    BT_HCIUART = module;
 | 
						|
    HID_APPLETB_BL = module;
 | 
						|
    HID_APPLETB_KBD = module;
 | 
						|
    HID_APPLE = module;
 | 
						|
    DRM_APPLETBDRM = module;
 | 
						|
    HID_SENSOR_ALS = module;
 | 
						|
    SND_PCM = module;
 | 
						|
    STAGING = yes;
 | 
						|
  };
 | 
						|
 | 
						|
  kernelPatches = [];
 | 
						|
} // (args.argsOverride or {}))
 |