From b53fc0a7858871e58332ee02ffbc0f256a0d5afe Mon Sep 17 00:00:00 2001 From: ChaosAttractor <46527539+LostAttractor@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:03:23 +0800 Subject: [PATCH] =?UTF-8?q?Add=20specialisation=20for=20=E2=80=9CDDG"=20mo?= =?UTF-8?q?de=20is=20enabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lenovo/legion/16ach6h/default.nix | 36 ++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lenovo/legion/16ach6h/default.nix b/lenovo/legion/16ach6h/default.nix index 4ecfd5a..d8149e1 100644 --- a/lenovo/legion/16ach6h/default.nix +++ b/lenovo/legion/16ach6h/default.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ config, lib, ... }: { imports = [ @@ -10,17 +10,29 @@ ./edid ]; - hardware.amdgpu.loadInInitrd = lib.mkDefault false; + config = lib.mkMerge [ + { + hardware.amdgpu.loadInInitrd = lib.mkDefault false; - hardware.nvidia = { - modesetting.enable = lib.mkDefault true; - powerManagement.enable = lib.mkDefault true; + hardware.nvidia = { + modesetting.enable = lib.mkDefault true; + powerManagement.enable = lib.mkDefault true; + }; + + services.thermald.enable = lib.mkDefault true; - prime = { - amdgpuBusId = "PCI:6:0:0"; - nvidiaBusId = "PCI:1:0:0"; - }; - }; + specialisation.ddg.configuration = { + # This specialisation is for the case where "DDG" (A hardware feature that can enable in bios) is enabled, since the amd igpu is blocked at hardware level and the built-in display is directly connected to the dgpu, we no longer need the amdgpu and prime configuration. + services.xserver.videoDrivers = [ "nvidia" ]; # This will override services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" "nvidia" ]; + hardware.nvidia.prime.offload.enable = false; + }; + } - services.thermald.enable = lib.mkDefault true; -} + (lib.mkIf (config.specialisation != {}) { + hardware.nvidia.prime = { + amdgpuBusId = "PCI:6:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }) + ]; +} \ No newline at end of file