| ... | ... | @@ -7,104 +7,4 @@ let |
| 7 | 7 | nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.latest; |
| 8 | 8 | in |
| 9 | 9 | { |
| 10 | | services.xserver.videoDrivers = [ |
| 11 | | "nvidia" |
| 12 | | "amdgpu" |
| 13 | | ]; |
| 14 | | |
| 15 | | nixpkgs.config = { |
| 16 | | nvidia.acceptLicense = true; |
| 17 | | allowUnfree = true; |
| 18 | | }; |
| 19 | | # Kernel parameters for better Wayland and Hyprland integration |
| 20 | | boot.kernelParams = [ |
| 21 | | "nvidia-drm.modeset=1" # Enable mode setting for Wayland |
| 22 | | "nvidia.NVreg_PreserveVideoMemoryAllocations=1" # Improves resume after sleep |
| 23 | | ]; |
| 24 | | |
| 25 | | # Blacklist nouveau to avoid conflicts |
| 26 | | boot.blacklistedKernelModules = [ "nouveau" ]; |
| 27 | | environment.variables = { |
| 28 | | LIBVA_DRIVER_NAME = "nvidia"; # Hardware video acceleration |
| 29 | | XDG_SESSION_TYPE = "wayland"; # Force Wayland |
| 30 | | GBM_BACKEND = "nvidia-drm"; # Graphics backend for Wayland |
| 31 | | __GLX_VENDOR_LIBRARY_NAME = "nvidia"; # Use Nvidia driver for GLX |
| 32 | | WLR_NO_HARDWARE_CURSORS = "1"; # Fix for cursors on Wayland |
| 33 | | NIXOS_OZONE_WL = "1"; # Wayland support for Electron apps |
| 34 | | __GL_GSYNC_ALLOWED = "1"; # Enable G-Sync if available |
| 35 | | __GL_VRR_ALLOWED = "1"; # Enable VRR (Variable Refresh Rate) |
| 36 | | WLR_DRM_NO_ATOMIC = "1"; # Fix for some issues with Hyprland |
| 37 | | NVD_BACKEND = "direct"; # Configuration for new driver |
| 38 | | MOZ_ENABLE_WAYLAND = "1"; # Wayland support for Firefox |
| 39 | | }; |
| 40 | | |
| 41 | | hardware = { |
| 42 | | nvidia = { |
| 43 | | forceFullCompositionPipeline = true; # Prevents screen tearing |
| 44 | | # Modesetting is required. |
| 45 | | modesetting.enable = true; |
| 46 | | |
| 47 | | powerManagement = { |
| 48 | | enable = true; # Power management |
| 49 | | finegrained = true; # More precise power consumption control |
| 50 | | }; |
| 51 | | |
| 52 | | prime = { |
| 53 | | offload = { |
| 54 | | enable = true; |
| 55 | | enableOffloadCmd = true; |
| 56 | | }; |
| 57 | | |
| 58 | | nvidiaBusId = "PCI:1:0:0"; |
| 59 | | amdgpuBusId = "PCI:15:0:0"; |
| 60 | | |
| 61 | | }; |
| 62 | | |
| 63 | | # Use the NVidia open source kernel module (not to be confused with the |
| 64 | | # independent third-party "nouveau" open source driver). |
| 65 | | # Currently alpha-quality/buggy, so false is currently the recommended setting. |
| 66 | | open = true; |
| 67 | | |
| 68 | | # Environment variables for better compatibility |
| 69 | | |
| 70 | | # Enable the Nvidia settings menu, |
| 71 | | # accessible via `nvidia-settings`. |
| 72 | | nvidiaSettings = true; |
| 73 | | |
| 74 | | package = nvidiaDriverChannel; |
| 75 | | |
| 76 | | # #Fixes a glitch |
| 77 | | # nvidiaPersistenced = true; |
| 78 | | }; |
| 79 | | nvidia-container-toolkit.enable = true; |
| 80 | | |
| 81 | | graphics = { |
| 82 | | enable = true; |
| 83 | | package = nvidiaDriverChannel; |
| 84 | | enable32Bit = true; |
| 85 | | extraPackages = with pkgs; [ |
| 86 | | nvidia-vaapi-driver |
| 87 | | vaapiVdpau |
| 88 | | libvdpau-va-gl |
| 89 | | mesa |
| 90 | | egl-wayland |
| 91 | | vulkan-loader |
| 92 | | vulkan-validation-layers |
| 93 | | libva |
| 94 | | ]; |
| 95 | | }; |
| 96 | | }; |
| 97 | | |
| 98 | | nix.settings = { |
| 99 | | substituters = [ "https://cuda-maintainers.cachix.org" ]; |
| 100 | | trusted-public-keys = [ |
| 101 | | "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" |
| 102 | | ]; |
| 103 | | }; |
| 104 | | |
| 105 | | environment.systemPackages = with pkgs; [ |
| 106 | | vulkan-tools |
| 107 | | glxinfo |
| 108 | | libva-utils # VA-API debugging tools |
| 109 | | ]; |
| 110 | 10 | } |