1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-30 06:49:43 +01:00

Add standalone hybrid only and nvidia only modules

This commit is contained in:
ChaosAttractor 2022-12-19 22:55:29 +08:00
parent b53fc0a785
commit ab165ab191
6 changed files with 51 additions and 34 deletions

View file

@ -128,6 +128,8 @@ See code for all available configurations.
| [Lenovo Legion 5 15arh05h](lenovo/legion/15arh05h) | `<nixos-hardware/lenovo/legion/15arh05h>` |
| [Lenovo Legion 7 Slim 15ach6](lenovo/legion/15ach6) | `<nixos-hardware/lenovo/legion/15ach6>` |
| [Lenovo Legion 5 Pro 16ach6h](lenovo/legion/16ach6h) | `<nixos-hardware/lenovo/legion/16ach6h>` |
| [Lenovo Legion 5 Pro 16ach6h (Hybrid)](lenovo/legion/16ach6h/hybrid)| `<nixos-hardware/lenovo/legion/16ach6h/hybrid>` |
| [Lenovo Legion 5 Pro 16ach6h (Nvidia)](lenovo/legion/16ach6h/nvidia)| `<nixos-hardware/lenovo/legion/16ach6h/nvidia>` |
| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `<nixos-hardware/lenovo/thinkpad/e14/amd>` |
| [Lenovo ThinkPad E14 (Intel)](lenovo/thinkpad/e14/intel) | `<nixos-hardware/lenovo/thinkpad/e14/intel>` |
| [Lenovo ThinkPad E470](lenovo/thinkpad/e470) | `<nixos-hardware/lenovo/thinkpad/e470>` |

View file

@ -62,6 +62,8 @@
lenovo-legion-15ach6 = import ./lenovo/legion/15ach6;
lenovo-legion-15arh05h = import ./lenovo/legion/15arh05h;
lenovo-legion-16ach6h = import ./lenovo/legion/16ach6h;
lenovo-legion-16ach6h-hybrid = import ./lenovo/legion/16ach6h/hybrid;
lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia;
lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6;
lenovo-thinkpad = import ./lenovo/thinkpad;
lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd;

View file

@ -1,3 +1,8 @@
## Introduction
Due to the introduction of DDG feature, you may toggle DDG frequently, so for the default settings of this laptop, we use "specialization" feature of Nix so that you can easily select the required graphics card driver in the startup menu.
**But It will slow down NixOS evaluation by factor 2 and increase memory usage.**
So if you don't need specialization feature, you can just use hybrid only configuration or nvidia only (DDG only) configuration
## Setup at the time of testing
```
$ nix-info -m

View file

@ -1,25 +1,7 @@
{ config, lib, ... }:
{ ... }:
{
imports = [
../../../common/cpu/amd
../../../common/gpu/amd
../../../common/gpu/nvidia/prime.nix
../../../common/pc/laptop
../../../common/pc/laptop/ssd
./edid
];
config = lib.mkMerge [
{
hardware.amdgpu.loadInInitrd = lib.mkDefault false;
hardware.nvidia = {
modesetting.enable = lib.mkDefault true;
powerManagement.enable = lib.mkDefault true;
};
services.thermald.enable = lib.mkDefault true;
imports = [ ./hybrid ];
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.
@ -27,12 +9,3 @@
hardware.nvidia.prime.offload.enable = false;
};
}
(lib.mkIf (config.specialisation != {}) {
hardware.nvidia.prime = {
amdgpuBusId = "PCI:6:0:0";
nvidiaBusId = "PCI:1:0:0";
};
})
];
}

View file

@ -0,0 +1,28 @@
{ config, lib, ... }:
{
imports = [
../../../../common/cpu/amd
../../../../common/gpu/amd
../../../../common/gpu/nvidia/prime.nix
../../../../common/pc/laptop
../../../../common/pc/laptop/ssd
../edid
];
hardware = {
amdgpu.loadInInitrd = lib.mkDefault false;
nvidia = {
modesetting.enable = lib.mkDefault true;
powerManagement.enable = lib.mkDefault true;
prime = {
amdgpuBusId = "PCI:6:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
};
services.thermald.enable = lib.mkDefault true;
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
imports = [ ../hybrid ];
services.xserver.videoDrivers = [ "nvidia" ]; # This will override services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" "nvidia" ];
hardware.nvidia.prime.offload.enable = false;
}