fixes and nvidia
This commit is contained in:
		
							
								
								
									
										64
									
								
								modules/nixos/nvidia.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								modules/nixos/nvidia.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
| { | ||||
|     config, | ||||
|     lib, | ||||
|     pkgs, | ||||
|     ... | ||||
| }: | ||||
| { | ||||
|  | ||||
|   # Enable OpenGL | ||||
|   hardware.opengl = { | ||||
|     enable = true; | ||||
|   }; | ||||
|  | ||||
|   # Load nvidia driver for Xorg and Wayland | ||||
|   services.xserver.videoDrivers = ["nvidia"]; | ||||
|  | ||||
|   hardware.nvidia = { | ||||
|     # manually specify the driver version | ||||
|     package = config.boot.kernelPackages.nvidiaPackages.mkDriver { | ||||
|       version = "555.58.02"; | ||||
|       sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; | ||||
|       sha256_aarch64 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; | ||||
|       openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY="; | ||||
|       settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8="; | ||||
|       persistencedSha256 = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM="; | ||||
|     }; | ||||
|  | ||||
|     # 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 = 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; | ||||
|  | ||||
|     open = false; | ||||
|  | ||||
|     # Enable the Nvidia settings menu, | ||||
| 	  # accessible via `nvidia-settings`. | ||||
|     nvidiaSettings = true; | ||||
|   }; | ||||
|  | ||||
|   ## See https://nixos.wiki/wiki/Nvidia | ||||
|   hardware.nvidia.prime = { | ||||
| 		intelBusId = "PCI:0:2:0"; | ||||
| 		nvidiaBusId = "PCI:1:0:0"; | ||||
|  | ||||
|     ## Reverse PRIME synchronization | ||||
|     reverseSync.enable = true; | ||||
|     # Enable if using an external GPU | ||||
|     allowExternalGpu = false; | ||||
|  | ||||
|     ## Alternatively enable offloading | ||||
|     # offload = { | ||||
| 		# 	enable = true; | ||||
| 		# 	enableOffloadCmd = true; | ||||
| 		# }; | ||||
| 	}; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user