From 485f3bc2f27b63c558bee579b6a0d5c10291c1ec Mon Sep 17 00:00:00 2001 From: suliman Date: Sat, 24 Dec 2022 02:38:10 +0300 Subject: [PATCH 1/7] Add LENOVO Yoga 6 13ALC6 82ND --- README.md | 1 + flake.nix | 1 + lenovo/yoga/6/13ALC6/default.nix | 51 ++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 lenovo/yoga/6/13ALC6/default.nix diff --git a/README.md b/README.md index 1d73f7a..fa388d1 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ See code for all available configurations. | [Lenovo ThinkPad X280](lenovo/thinkpad/x280) | `` | | [Lenovo ThinkPad Z Series](lenovo/thinkpad/z) | `` | | [Lenovo ThinkPad Z13](lenovo/thinkpad/z/z13) | `` | +| [LENOVO Yoga 6 13ALC6 82ND](lenovo/yoga/6/13ALC6) | `` | | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | diff --git a/flake.nix b/flake.nix index 5b79eca..387ffbb 100644 --- a/flake.nix +++ b/flake.nix @@ -127,6 +127,7 @@ lenovo-thinkpad-x280 = import ./lenovo/thinkpad/x280; lenovo-thinkpad-z = import ./lenovo/thinkpad/z; lenovo-thinkpad-z13 = import ./lenovo/thinkpad/z/z13; + lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; microsoft-surface = import ./microsoft/surface; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix new file mode 100644 index 0000000..97b6739 --- /dev/null +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -0,0 +1,51 @@ +{ lib, pkgs, ... }: + +{ + boot.initrd.kernelModules = [ + "amdgpu" + "ideapad_laptop" + ]; + services.xserver.videoDrivers = [ "amdgpu" ]; + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + amdvlk + vaapiVdpau + libvdpau-va-gl + ]; + hardware.opengl.extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + hardware.opengl = { + driSupport = lib.mkDefault true; + driSupport32Bit = lib.mkDefault true; + }; + environment.variables.AMD_VULKAN_ICD = lib.mkDefault "RADV"; + + # Latest Kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + hardware.bluetooth.powerOnBoot = lib.mkDefault false; + services.power-profiles-daemon.enable = false; + services.tlp.enable = lib.mkDefault true; + # automatic screen orientation, only works in X11 + hardware.sensor.iio.enable = true; + # energy savings + boot.kernelParams = ["mem_sleep_default=deep" "pcie_aspm.policy=powersupersave"]; + powerManagement.enable = lib.mkDefault true; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + services.tlp.settings = { + # CPU + CPU_SCALING_GOVERNOR_ON_BAT="ondemand"; + CPU_SCALING_GOVERNOR_ON_AC="performance"; + CPU_BOOST_ON_AC=1; + CPU_BOOST_ON_BAT=0; + # Stop charging battery at 60%, ideapad_laptop driver required + #STOP_CHARGE_THRESH_BAT0=1; + # Stop charging battery at 100% + STOP_CHARGE_THRESH_BAT0=0; + # GPU + RADEON_DPM_PERF_LEVEL_ON_AC="auto"; + RADEON_DPM_PERF_LEVEL_ON_BAT="low"; + }; +} From 2e8fce47c8bd3a0936ac9e4e5d7983fc96caa25e Mon Sep 17 00:00:00 2001 From: suliman Date: Wed, 28 Dec 2022 23:10:35 +0300 Subject: [PATCH 2/7] Reusing modules --- lenovo/yoga/6/13ALC6/default.nix | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index 97b6739..1697701 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -1,36 +1,24 @@ { lib, pkgs, ... }: { - boot.initrd.kernelModules = [ - "amdgpu" - "ideapad_laptop" + imports = [ + ../../../thinkpad/yoga.nix + ../../../../common/gpu/amd/default.nix ]; - services.xserver.videoDrivers = [ "amdgpu" ]; + + boot.initrd.kernelModules = [ "ideapad_laptop" ]; hardware.opengl.extraPackages = with pkgs; [ - rocm-opencl-icd - rocm-opencl-runtime - amdvlk vaapiVdpau libvdpau-va-gl ]; - hardware.opengl.extraPackages32 = with pkgs; [ - driversi686Linux.amdvlk - ]; - hardware.opengl = { - driSupport = lib.mkDefault true; - driSupport32Bit = lib.mkDefault true; - }; - environment.variables.AMD_VULKAN_ICD = lib.mkDefault "RADV"; # Latest Kernel - boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + # energy savings hardware.bluetooth.powerOnBoot = lib.mkDefault false; services.power-profiles-daemon.enable = false; services.tlp.enable = lib.mkDefault true; - # automatic screen orientation, only works in X11 - hardware.sensor.iio.enable = true; - # energy savings boot.kernelParams = ["mem_sleep_default=deep" "pcie_aspm.policy=powersupersave"]; powerManagement.enable = lib.mkDefault true; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; From a30c4834f48a8d4da5c5d46926287cda4665078a Mon Sep 17 00:00:00 2001 From: me00001 <37930867+me00001@users.noreply.github.com> Date: Thu, 29 Dec 2022 13:23:08 +0300 Subject: [PATCH 3/7] set a minimum kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- lenovo/yoga/6/13ALC6/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index 1697701..3b1cf96 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -12,8 +12,7 @@ libvdpau-va-gl ]; - # Latest Kernel - boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") pkgs.linuxPackages_latest; # energy savings hardware.bluetooth.powerOnBoot = lib.mkDefault false; From 114881dd3dc7de292625886995f23d5b35fb715a Mon Sep 17 00:00:00 2001 From: suliman Date: Thu, 29 Dec 2022 14:42:08 +0300 Subject: [PATCH 4/7] Minimum required version is 5.16 based on https://linux-hardware.org/?id=pci:10ec-8852-17aa-4852 --- lenovo/yoga/6/13ALC6/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index 3b1cf96..629cea8 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -12,7 +12,7 @@ libvdpau-va-gl ]; - boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; # energy savings hardware.bluetooth.powerOnBoot = lib.mkDefault false; From 993e6c8726f6c75bab73236d1bce94a2e79160f2 Mon Sep 17 00:00:00 2001 From: suliman Date: Thu, 29 Dec 2022 16:50:43 +0300 Subject: [PATCH 5/7] removo TLP --- lenovo/yoga/6/13ALC6/default.nix | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index 629cea8..6b830c3 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -16,23 +16,5 @@ # energy savings hardware.bluetooth.powerOnBoot = lib.mkDefault false; - services.power-profiles-daemon.enable = false; - services.tlp.enable = lib.mkDefault true; boot.kernelParams = ["mem_sleep_default=deep" "pcie_aspm.policy=powersupersave"]; - powerManagement.enable = lib.mkDefault true; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; - services.tlp.settings = { - # CPU - CPU_SCALING_GOVERNOR_ON_BAT="ondemand"; - CPU_SCALING_GOVERNOR_ON_AC="performance"; - CPU_BOOST_ON_AC=1; - CPU_BOOST_ON_BAT=0; - # Stop charging battery at 60%, ideapad_laptop driver required - #STOP_CHARGE_THRESH_BAT0=1; - # Stop charging battery at 100% - STOP_CHARGE_THRESH_BAT0=0; - # GPU - RADEON_DPM_PERF_LEVEL_ON_AC="auto"; - RADEON_DPM_PERF_LEVEL_ON_BAT="low"; - }; } From c1a38081fa17eb4d1692f4df27bd48e59ac12b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 29 Dec 2022 13:52:15 +0000 Subject: [PATCH 6/7] Update lenovo/yoga/6/13ALC6/default.nix --- lenovo/yoga/6/13ALC6/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index 6b830c3..b56bc9c 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -12,6 +12,7 @@ libvdpau-va-gl ]; + # latest kernel needed to make wifi work boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; # energy savings From 49485f5569f290bf9d3daf893d9df3daf4d016be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 29 Dec 2022 13:53:01 +0000 Subject: [PATCH 7/7] Update lenovo/yoga/6/13ALC6/default.nix --- lenovo/yoga/6/13ALC6/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/lenovo/yoga/6/13ALC6/default.nix b/lenovo/yoga/6/13ALC6/default.nix index b56bc9c..bd2e80c 100644 --- a/lenovo/yoga/6/13ALC6/default.nix +++ b/lenovo/yoga/6/13ALC6/default.nix @@ -16,6 +16,5 @@ boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") pkgs.linuxPackages_latest; # energy savings - hardware.bluetooth.powerOnBoot = lib.mkDefault false; boot.kernelParams = ["mem_sleep_default=deep" "pcie_aspm.policy=powersupersave"]; }