mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-12-18 15:49:45 +01: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:
parent
79a20e2ac0
commit
e1c4bac14b
9 changed files with 91 additions and 11 deletions
|
@ -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>` |
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 don’t 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");
|
||||
}
|
||||
|
|
8
lenovo/thinkpad/z/gen1/default.nix
Normal file
8
lenovo/thinkpad/z/gen1/default.nix
Normal 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);
|
||||
}
|
5
lenovo/thinkpad/z/gen1/z13/default.nix
Normal file
5
lenovo/thinkpad/z/gen1/z13/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
../../../../../lenovo/thinkpad/z/gen1
|
||||
];
|
||||
}
|
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
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
../../../../lenovo/thinkpad/z
|
||||
];
|
||||
}
|
10
lenovo/thinkpad/z13/default.nix
Normal file
10
lenovo/thinkpad/z13/default.nix
Normal 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`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue