From b2186d6c3cdc58fb3a8def0f608bcae61138cc6f Mon Sep 17 00:00:00 2001 From: Pavel Nazarov Date: Tue, 1 Jun 2021 07:30:09 +0300 Subject: [PATCH] Add lenovo-thinkpad-p1 (#266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- README.md | 4 ++++ flake.nix | 2 ++ lenovo/thinkpad/p1/3th-gen/audio.nix | 7 +++++++ lenovo/thinkpad/p1/3th-gen/default.nix | 7 +++++++ lenovo/thinkpad/p1/3th-gen/nvidia.nix | 13 +++++++++++++ lenovo/thinkpad/p1/default.nix | 17 +++++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 lenovo/thinkpad/p1/3th-gen/audio.nix create mode 100644 lenovo/thinkpad/p1/3th-gen/default.nix create mode 100644 lenovo/thinkpad/p1/3th-gen/nvidia.nix create mode 100644 lenovo/thinkpad/p1/default.nix diff --git a/README.md b/README.md index 6ba22cd..5845f8e 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ See code for all available configurations. | Lenovo ThinkPad L13 | `` | | Lenovo ThinkPad L14 (Intel) | ` | | Lenovo ThinkPad L14 (AMD) | ` | +| Lenovo ThinkPad P1 | `` | +| Lenovo ThinkPad P1 Gen 3 | `` | | Lenovo ThinkPad P53 | `` | | Lenovo ThinkPad T14 | `` | | Lenovo ThinkPad T14 AMD Gen 1 | `` | @@ -169,6 +171,8 @@ See code for all available configurations. [Google Pixelbook]: google/pixelbook [GPD MicroPC]: gpd/micropc [Inverse Path USB armory]: inversepath/usbarmory +[Lenovo ThinkPad P1]: lenovo/thinkpad/p1 +[Lenovo ThinkPad P1 (3th Gen)]: lenovo/thinkpad/p1/3th-gen [Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen [Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen [Lenovo ThinkPad X13]: lenovo/thinkpad/x13 diff --git a/flake.nix b/flake.nix index 97934ce..1d37f22 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,8 @@ lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13; lenovo-thinkpad-l14-intel = import ./lenovo/thinkpad/l14/intel; lenovo-thinkpad-l14-amd = import ./lenovo/thinkpad/l14/amd; + lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; + lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; lenovo-thinkpad-p53 = import ./lenovo/thinkpad/p53; lenovo-thinkpad-t14 = import ./lenovo/thinkpad/t14; lenovo-thinkpad-t14-amd-gen1 = import ./lenovo/thinkpad/t14/amd/gen1; diff --git a/lenovo/thinkpad/p1/3th-gen/audio.nix b/lenovo/thinkpad/p1/3th-gen/audio.nix new file mode 100644 index 0000000..8b6c854 --- /dev/null +++ b/lenovo/thinkpad/p1/3th-gen/audio.nix @@ -0,0 +1,7 @@ +{ lib, pkgs, ... }: +{ + # This can be removed when the default kernel is at least version 5.11 due to sof module + boot.kernelPackages = lib.mkIf + (lib.versionOlder pkgs.linux.version "5.11") + (lib.mkDefault pkgs.linuxPackages_latest); +} diff --git a/lenovo/thinkpad/p1/3th-gen/default.nix b/lenovo/thinkpad/p1/3th-gen/default.nix new file mode 100644 index 0000000..3eb9eaa --- /dev/null +++ b/lenovo/thinkpad/p1/3th-gen/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ../. + ./audio.nix + ./nvidia.nix + ]; +} diff --git a/lenovo/thinkpad/p1/3th-gen/nvidia.nix b/lenovo/thinkpad/p1/3th-gen/nvidia.nix new file mode 100644 index 0000000..62d9ebc --- /dev/null +++ b/lenovo/thinkpad/p1/3th-gen/nvidia.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, ... }: +{ + hardware.nvidia.modesetting.enable = true; + hardware.opengl.driSupport32Bit = true; + hardware.opengl.enable = true; + + 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"; + }; +} diff --git a/lenovo/thinkpad/p1/default.nix b/lenovo/thinkpad/p1/default.nix new file mode 100644 index 0000000..b3554c2 --- /dev/null +++ b/lenovo/thinkpad/p1/default.nix @@ -0,0 +1,17 @@ +{ + imports = [ + ../../../common/cpu/intel + ../../../common/gpu/nvidia.nix + ../../../common/pc/laptop/acpi_call.nix + ../../../common/pc/laptop/ssd + ]; + + # Need to set Thunderbolt to "BIOS Assist Mode" + # https://forums.lenovo.com/t5/Other-Linux-Discussions/T480-CPU-temperature-and-fan-speed-under-linux/m-p/4114832 + boot.kernelParams = [ "acpi_backlight=native" ]; + + # Emulate mouse wheel on trackpoint + # hardware.trackpoint.emulateWheel = true; + + services.fprintd.enable = true; +}