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:
Mic92 2024-04-10 14:40:48 +00:00 committed by mergify[bot]
parent 79a20e2ac0
commit e1c4bac14b
9 changed files with 91 additions and 11 deletions

View file

@ -238,7 +238,8 @@ See code for all available configurations.
| [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `<nixos-hardware/lenovo/thinkpad/x280>` |
| [Lenovo ThinkPad X390](lenovo/thinkpad/x390) | `<nixos-hardware/lenovo/thinkpad/x390>` |
| [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `<nixos-hardware/lenovo/thinkpad/z>` |
| [Lenovo ThinkPad Z13](lenovo/thinkpad/z/z13) | `<nixos-hardware/lenovo/thinkpad/z/z13>` |
| [Lenovo ThinkPad Z13 Gen 1](lenovo/thinkpad/z/gen1/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen1/z13>` |
| [Lenovo ThinkPad Z13 Gen 2](lenovo/thinkpad/z/gen2/z13) | `<nixos-hardware/lenovo/thinkpad/z/gen2/z13>` |
| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `<nixos-hardware/lenovo/yoga/6/13ALC6>` |
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/amdgpu) | `<nixos-hardware/lenovo/yoga/7/14ARH7/amdgpu>` |
| [LENOVO Yoga Slim 7 Pro-X 14ARH7 82ND](lenovo/yoga/7/14ARH7/nvidia) | `<nixos-hardware/lenovo/yoga/7/14ARH7/nvidia>` |

View file

@ -175,7 +175,8 @@
lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280;
lenovo-thinkpad-x390 = import ./lenovo/thinkpad/x390;
lenovo-thinkpad-z = import ./lenovo/thinkpad/z;
lenovo-thinkpad-z13 = import ./lenovo/thinkpad/z/z13;
lenovo-thinkpad-z13-gen1 = import ./lenovo/thinkpad/z/gen1/z13;
lenovo-thinkpad-z13-gen2 = import ./lenovo/thinkpad/z/gen2/z13;
lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6;
lenovo-yoga-7-14ARH7 = import ./lenovo/yoga/7/14ARH7;
lenovo-yoga-7-slim-gen8 = import ./lenovo/yoga/7/slim/gen8;

View file

@ -7,17 +7,14 @@
../../../common/pc/laptop
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/ssd
../../../common/hidpi.nix # can be dropped after nixos 23.05
];
# kernel versions prior to 5.18 won't boot
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
hardware.enableRedistributableFirmware = lib.mkDefault true;
hardware.trackpoint.device = lib.mkDefault "TPPS/2 Elan TrackPoint";
services.fprintd.enable = lib.mkDefault true;
# kernel versions below 6.0 don't contain ACPI suspend2idle drivers for the Z13s AMD hardware
# kernel versions below 6.0 dont contain ACPI suspend2idle drivers for the Z-series AMD hardware
# my Z13 froze after waking up from suspend/ hibernate
services.logind.lidSwitch = lib.mkIf (lib.versionOlder pkgs.linux.version "6.00") (lib.mkDefault "lock");
}

View file

@ -0,0 +1,8 @@
{ lib, pkgs, ... }: {
imports = [
../../../../lenovo/thinkpad/z
];
# Kernel 5.18 is required for the Ryzen 6000 series
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.18") (lib.mkDefault pkgs.linuxPackages_latest);
}

View file

@ -0,0 +1,5 @@
{
imports = [
../../../../../lenovo/thinkpad/z/gen1
];
}

View 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
'';
};
};
}

View 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
}
'';
}

View file

@ -1,5 +0,0 @@
{
imports = [
../../../../lenovo/thinkpad/z
];
}

View file

@ -0,0 +1,10 @@
{
assertions = [
{
assertion = true;
message = ''
Lenovo Z-series received a second generation so the hardware configuration has been split by generation. For the Z13 Gen 1 config, change from `lenovo-thinkpad-z13` to `lenovo-thinkpad-z13-gen1`.
'';
}
];
}