This commit is contained in:
2025-06-06 01:36:55 +02:00
parent 7d07de663d
commit ce387ab5db
6 changed files with 274 additions and 97 deletions

View File

@@ -18,6 +18,41 @@ in
# Enable NVIDIA driver for X11 and Wayland
services.xserver.videoDrivers = [ "amdgpu" "nvidia" ];
services.xserver.displayManager.xserverArgs = [ "-config" "/opt/x11/xserver.conf" ];
services.xserver.config = lib.mkAfter ''
Section "ServerLayout"
Identifier "layout"
Screen 0 "amdgpu"
Inactive "nvidia"
Option "AllowNVIDIAGPUScreens"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:01:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
EndSection
Section "Device"
Identifier "amdgpu"
Driver "amdgpu"
BusID "PCI:50:0:0"
EndSection
Section "Screen"
Identifier "amdgpu"
Device "amdgpu"
EndSection
'';
services.switcherooControl.enable = true;
# Enable OpenGL
hardware.graphics = {
enable = true;
@@ -25,7 +60,7 @@ in
};
# Use Beta Driver Package
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_beta ];
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
@@ -33,22 +68,22 @@ in
# Enable required Kernel Modules
boot.initrd.kernelModules = [
"amdgpu"
"nvidia-modeset"
"nvidia"
# "nvidia-drm"
"nvidiafb"
# "amdgpu"
"nvidia-drm"
# "nvidiafb"
# "nvidia-uvm"
# "nvidia-modeset"
# "i2c-nvidia_gpu"
];
boot.kernelParams = [
"amdgpu.modeset=1"
# "amdgpu.modeset=1"
"nvidia-drm.fbdev=1"
"nvidia-drm.modeset=0"
"nvidia-drm.modeset=1"
# "nvidia.NVreg_PreserveVideoMemoryAllocations=0"
"amd_iommu=on"
# "amd_iommu=on"
# "vfio-pci.ids=\"10de:2489,10de:228b\""
# "nomodeset"
# "nvidia_drm.modeset=1"
@@ -102,7 +137,8 @@ in
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.beta;
# package = config.boot.kernelPackages.nvidiaPackages.beta;
package = config.boot.kernelPackages.nvidiaPackages.stable;
# package = config.boot.kernelPackages.nvidiaPackages.none;
# package = config.boot.kernelPackages.nvidiaPackages.production;
@@ -110,10 +146,12 @@ in
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
enable = lib.mkForce true;
enableOffloadCmd = lib.mkForce true;
};
reverseSync.enable = false;
reverseSync.enable = lib.mkForce false;
sync.enable = lib.mkForce false;
# Make sure to use the correct Bus ID values for your system!
# intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:01:0:0";
@@ -128,4 +166,5 @@ in
};
};
}