From 4454eb84fbb319df5e22fb0452c4d611f5a78083 Mon Sep 17 00:00:00 2001 From: Andreas Schaafsma Date: Mon, 9 Dec 2024 23:35:27 +0100 Subject: [PATCH] whatever, still sorta works --- .../default.nix | 137 +++++++++++------- 1 file changed, 86 insertions(+), 51 deletions(-) diff --git a/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix b/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix index dd05342..67f77d2 100644 --- a/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix +++ b/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix @@ -18,9 +18,13 @@ in # Enable NVIDIA driver for X11 and Wayland # without modesetting, x server will be run by nvidia services.xserver.videoDrivers = [ - "amdgpu" - #"modesetting" "nvidia" + # "nvidia-drm" + # "nvidia-uvm" + # "nvidia-modeset" + # "nvidiafb" + "amdgpu" + # "modesetting" ]; # Enable OpenGL @@ -43,13 +47,13 @@ in # Enable required Kernel Modules boot.initrd.kernelModules = [ - "amdgpu" "nvidia" - # # "nvidia-drm" - # # "nvidiafb" - # # # "nvidia-uvm" - # # "nvidia-modeset" - # # "i2c-nvidia_gpu" + "nvidia-drm" + "nvidia-uvm" + "nvidia-modeset" + "nvidiafb" + "amdgpu" + # # "i2c-nvidia_gpu" ]; @@ -83,59 +87,90 @@ in # options nouveau modeset=0 # ''; + # services.xserver.config = lib.mkForce '' + # 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 + # ''; + # Configure NVIDIA driver hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; + # Modesetting is required. + modesetting.enable = true; - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = true; + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + 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.none; - # package = config.boot.kernelPackages.nvidiaPackages.production; - nvidiaPersistenced = true; - forceFullCompositionPipeline = false; + # 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.none; + # package = config.boot.kernelPackages.nvidiaPackages.production; + nvidiaPersistenced = true; + forceFullCompositionPipeline = true; - prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - # sync.enable=true; - # reverseSync.enable = false; - # Make sure to use the correct Bus ID values for your system! - # intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - amdgpuBusId = "PCI:50:0:0"; #For AMD GPU + prime = { + offload = { + enable = true; + enableOffloadCmd = true; }; - - }; - # Add user to extra groups - users.users.andreas = { - extraGroups = [ "video" "render" ]; + # sync.enable=true; + # reverseSync.enable = false; + # Make sure to use the correct Bus ID values for your system! + # intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + amdgpuBusId = "PCI:50:0:0"; #For AMD GPU }; }; + # Add user to extra groups + users.users.andreas = { + extraGroups = [ "video" "render" ]; + }; + +}; }