mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-12-12 12:49:47 +01:00
e1c4bac14b
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
44 lines
1.2 KiB
Nix
44 lines
1.2 KiB
Nix
{ 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
|
|
'';
|
|
};
|
|
};
|
|
}
|