mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	Lenovo ThinkPad Z13 Gen 2 (#844)
lenovo-thinkpad-z: remove HiDPI * lenovo-thinkpad-z: move z13 to gen1/z13, leave generic settings * lenovo-thinkpad-z-gen2: add z13 * Update lenovo/thinkpad/z/gen2/default.nix * Update lenovo/thinkpad/z/gen2/default.nix
This commit is contained in:
		
							
								
								
									
										44
									
								
								lenovo/thinkpad/z/gen2/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								lenovo/thinkpad/z/gen2/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
{ lib, pkgs, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../../../../lenovo/thinkpad/z
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  # Kernel 6.4 is required for the Ryzen 7040 series
 | 
			
		||||
  boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.4") (lib.mkDefault pkgs.linuxPackages_latest);
 | 
			
		||||
 | 
			
		||||
  systemd.services = {
 | 
			
		||||
    # Modified from Arch Wiki
 | 
			
		||||
    "touchpad-fix" = {
 | 
			
		||||
      enable = lib.mkDefault true;
 | 
			
		||||
      description = "I2C HID devices can fail to initialize so try to reload";
 | 
			
		||||
      unitConfig = {
 | 
			
		||||
        Type = "oneshot";
 | 
			
		||||
      };
 | 
			
		||||
      serviceConfig = {
 | 
			
		||||
        User = "root";
 | 
			
		||||
      };
 | 
			
		||||
      wantedBy = [ "multi-user.target" ];
 | 
			
		||||
      after = [ "multi-user.target" ];
 | 
			
		||||
      script = ''
 | 
			
		||||
        count=0
 | 
			
		||||
        while true; do
 | 
			
		||||
            ${lib.getExe pkgs.libinput} list-devices | ${lib.getExe pkgs.gnugrep} --quiet SNSL && break
 | 
			
		||||
            count=$((count + 1))
 | 
			
		||||
 | 
			
		||||
            if test $count -ge 5; then
 | 
			
		||||
                echo "Touchpad not read after $count attempts"
 | 
			
		||||
                break
 | 
			
		||||
            fi
 | 
			
		||||
 | 
			
		||||
            echo "Touchpad not ready; attempt $count to reload"
 | 
			
		||||
            ${pkgs.kmod}/bin/rmmod i2c_hid_acpi
 | 
			
		||||
            ${pkgs.kmod}/bin/modprobe i2c_hid_acpi
 | 
			
		||||
 | 
			
		||||
            sleep $((2 + (count * 3)))
 | 
			
		||||
        done
 | 
			
		||||
      '';
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								lenovo/thinkpad/z/gen2/z13/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								lenovo/thinkpad/z/gen2/z13/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
{ pkgs, lib, ...}:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../../../../../lenovo/thinkpad/z/gen2
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  sound.extraConfig = ''
 | 
			
		||||
    pcm.!default {
 | 
			
		||||
        type plug
 | 
			
		||||
        slave.pcm "hw:1,0"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ctl.!default {
 | 
			
		||||
        type hw
 | 
			
		||||
        card 1
 | 
			
		||||
    }
 | 
			
		||||
  '';
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user