mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	Add Lenovo legion 16ARHA7 (#906)
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										38
									
								
								lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								lenovo/legion/16arha7/audio/lenovo-16ARHA7_speaker-fix.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
# Patch sourced from https://github.com/christian-bendiksen/kernel-6.8.0-63.16ARHA7.fc40
 | 
			
		||||
{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel }:
 | 
			
		||||
 | 
			
		||||
pkgs.stdenv.mkDerivation {
 | 
			
		||||
  pname = "lenovo-16ARHA7-speaker-fix-module";
 | 
			
		||||
  inherit (kernel) src version postPatch nativeBuildInputs;
 | 
			
		||||
 | 
			
		||||
  kernel_dev = kernel.dev;
 | 
			
		||||
  kernelVersion = kernel.modDirVersion;
 | 
			
		||||
 | 
			
		||||
  modulePath = "sound/pci/hda/";
 | 
			
		||||
 | 
			
		||||
  buildPhase = ''
 | 
			
		||||
    BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
 | 
			
		||||
 | 
			
		||||
    cp $BUILT_KERNEL/Module.symvers .
 | 
			
		||||
    cp $BUILT_KERNEL/.config        .
 | 
			
		||||
    cp $kernel_dev/vmlinux          .
 | 
			
		||||
 | 
			
		||||
    make "-j$NIX_BUILD_CORES" modules_prepare
 | 
			
		||||
    make "-j$NIX_BUILD_CORES" M=$modulePath modules
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  installPhase = ''
 | 
			
		||||
    make \
 | 
			
		||||
      INSTALL_MOD_PATH="$out" \
 | 
			
		||||
      XZ="xz -T$NIX_BUILD_CORES" \
 | 
			
		||||
      M="$modulePath" \
 | 
			
		||||
      modules_install
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
	patches = [ ./lenovo_16ARHA7_sound_fix.patch ];
 | 
			
		||||
 | 
			
		||||
  meta = {
 | 
			
		||||
    description = "Patch to get the speakers working for Lenovo Legion Slim 7 Gen 7 AMD (16ARHA7)";
 | 
			
		||||
    license = lib.licenses.gpl3;
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user