diff options
Diffstat (limited to 'modules/nixos-hardware/lenovo/thinkpad')
13 files changed, 150 insertions, 4 deletions
diff --git a/modules/nixos-hardware/lenovo/thinkpad/e470/default.nix b/modules/nixos-hardware/lenovo/thinkpad/e470/default.nix new file mode 100644 index 000000000000..c9bf8331b050 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/e470/default.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../common/cpu/intel/kaby-lake + ../../../common/gpu/nvidia.nix + ]; + + hardware.nvidia.prime = { + # Bus ID of the Intel GPU. + intelBusId = lib.mkDefault "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + }; + + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.6") pkgs.linuxPackages_latest; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/l14/amd/default.nix b/modules/nixos-hardware/lenovo/thinkpad/l14/amd/default.nix new file mode 100644 index 000000000000..c2d1534fd178 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/l14/amd/default.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../../common/cpu/amd + ]; + + boot.kernelParams = [ + # With BIOS version 1.12 and the IOMMU enabled, the amdgpu driver + # either crashes or is not able to attach to the GPU depending on + # the kernel version. I've seen no issues with the IOMMU disabled. + # + # BIOS version 1.13 claims to fix IOMMU issues, but we leave the + # IOMMU off to avoid a sad experience for those people that drew + # the short straw when they bought their laptop. + "iommu=off" + ]; + + # As of writing this, Linux 5.8 is the oldest kernel that is still + # supported and has decent Renoir support. + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.8") pkgs.linuxPackages_latest; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/l14/default.nix b/modules/nixos-hardware/lenovo/thinkpad/l14/default.nix new file mode 100644 index 000000000000..e014b7d0fa68 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/l14/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../common/pc/laptop/acpi_call.nix + ]; + + boot.kernelParams = [ + # Force use of the thinkpad_acpi driver for backlight control. + # This allows the backlight save/load systemd service to work. + "acpi_backlight=native" + ]; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/l14/intel/default.nix b/modules/nixos-hardware/lenovo/thinkpad/l14/intel/default.nix new file mode 100644 index 000000000000..088289f37c19 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/l14/intel/default.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../../common/cpu/intel + ]; + + services.throttled.enable = lib.mkDefault true; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/t14 b/modules/nixos-hardware/lenovo/thinkpad/t14 new file mode 120000 index 000000000000..7be5dd832dad --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/t14 @@ -0,0 +1 @@ +t14s/ \ No newline at end of file diff --git a/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/default.nix new file mode 100644 index 000000000000..2b860e847d65 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/default.nix @@ -0,0 +1,11 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../../common/cpu/amd + ]; + + # For support of newer AMD GPUs, backlight and internal microphone + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.8") pkgs.linuxPackages_latest; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/gen1/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/gen1/default.nix new file mode 100644 index 000000000000..cb1ec7d81b76 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/t14s/amd/gen1/default.nix @@ -0,0 +1,8 @@ + +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ]; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/t14s/default.nix b/modules/nixos-hardware/lenovo/thinkpad/t14s/default.nix new file mode 100644 index 000000000000..d783b21a8594 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/t14s/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../. + ../../../common/pc/laptop/acpi_call.nix + ]; + + # For suspending to RAM to work, set Config -> Power -> Sleep State to "Linux" in EFI. + # See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Suspend_issues + + # Fingerprint sensor requires a firmware-update to work. + + # Force use of the thinkpad_acpi driver for backlight control. + # This allows the backlight save/load systemd service to work. + boot.kernelParams = [ "acpi_backlight=native" ]; + + # see https://github.com/NixOS/nixpkgs/issues/69289 + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.2") pkgs.linuxPackages_latest; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/audio.nix b/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/audio.nix new file mode 100644 index 000000000000..f6ecf58aa337 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/audio.nix @@ -0,0 +1,15 @@ +{ lib, pkgs, ... }: +{ + # This can be removed when the default kernel is at least version 5.6 + # https://github.com/NixOS/nixpkgs/pull/86168 + boot.kernelPackages = lib.mkIf + (lib.versionOlder pkgs.linux.version "5.6") + (lib.mkDefault pkgs.linuxPackages_latest); + + # This can be removed when PulseAudio is at least version 14 + # https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7)#Audio + hardware.pulseaudio.extraConfig = '' + load-module module-alsa-sink device=hw:0,0 channels=4 + load-module module-alsa-source device=hw:0,6 channels=4 + ''; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/default.nix new file mode 100644 index 000000000000..8349d05678a2 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/x1/7th-gen/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ../. + ../../../../common/pc/laptop/acpi_call.nix + ./audio.nix + ]; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/x13-yoga/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x13-yoga/default.nix new file mode 100644 index 000000000000..2653910d44b4 --- /dev/null +++ b/modules/nixos-hardware/lenovo/thinkpad/x13-yoga/default.nix @@ -0,0 +1,13 @@ +{ config, lib, ... }: { + imports = [ + ../. + ../../../common/cpu/intel + ../../../common/pc/laptop/acpi_call.nix + ../../../common/pc/laptop/ssd + ]; + + # automatic screen orientation + hardware.sensor.iio.enable = true; + + services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable; +} diff --git a/modules/nixos-hardware/lenovo/thinkpad/x220/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x220/default.nix index 3cf18e397469..b28e27845b0b 100644 --- a/modules/nixos-hardware/lenovo/thinkpad/x220/default.nix +++ b/modules/nixos-hardware/lenovo/thinkpad/x220/default.nix @@ -3,7 +3,7 @@ { imports = [ ../. - ../../../common/cpu/intel + ../../../common/cpu/intel/sandy-bridge ../../../common/pc/laptop/hdd # TODO: reverse compat ../tp-smapi.nix ]; diff --git a/modules/nixos-hardware/lenovo/thinkpad/x260/default.nix b/modules/nixos-hardware/lenovo/thinkpad/x260/default.nix index d64a53075163..c11ef98f79e0 100644 --- a/modules/nixos-hardware/lenovo/thinkpad/x260/default.nix +++ b/modules/nixos-hardware/lenovo/thinkpad/x260/default.nix @@ -5,8 +5,13 @@ ../../../common/pc/laptop/acpi_call.nix ]; + boot.kernelParams = [ + # https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X260#Thinkpad_X260 + "i915.enable_psr=0" + ]; + # https://wiki.archlinux.org/index.php/TLP#Btrfs - services.tlp.extraConfig = '' - SATA_LINKPWR_ON_BAT=med_power_with_dipm - ''; + services.tlp.settings = { + SATA_LINKPWR_ON_BAT = "med_power_with_dipm"; + }; } |