add amd-igpu only config
This commit is contained in:
		
							parent
							
								
									b4e3457721
								
							
						
					
					
						commit
						48f1d774c9
					
				
							
								
								
									
										59
									
								
								modules/nixos/hardware/graphics-amd-igpu-only/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								modules/nixos/hardware/graphics-amd-igpu-only/default.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,59 @@ | |||||||
|  | { config | ||||||
|  | , lib | ||||||
|  | , pkgs | ||||||
|  | , ... | ||||||
|  | }: | ||||||
|  | let | ||||||
|  |   inherit (lib) mkEnableOption mkIf; | ||||||
|  |   inherit (lib.my-namespace) disabled enabled; | ||||||
|  | 
 | ||||||
|  |   cfg = config.my-namespace.hardware.graphics-amd-igpu-only; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   options.my-namespace.hardware.graphics-amd-igpu-only = { | ||||||
|  |     enable = mkEnableOption "Enable nvidia"; | ||||||
|  |   }; | ||||||
|  |   config = mkIf cfg.enable { | ||||||
|  | 
 | ||||||
|  |     # Enable NVIDIA driver for X11 and Wayland | ||||||
|  |     # without modesetting, x server will be run by nvidia | ||||||
|  |     services.xserver.videoDrivers = [ | ||||||
|  |       "amdgpu" | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     # Enable OpenGL | ||||||
|  |     hardware.graphics = { | ||||||
|  |       enable = true; | ||||||
|  |       # extraPackages = with pkgs; [ nvidia-vaapi-driver ]; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     hardware.graphics.enable32Bit = true; # For 32 bit applications | ||||||
|  | 
 | ||||||
|  |     boot.loader.systemd-boot.consoleMode = "max"; | ||||||
|  | 
 | ||||||
|  |     # Enable required Kernel Modules | ||||||
|  |     boot.initrd.kernelModules = [ | ||||||
|  |       "amdgpu" | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     boot.kernelParams = [ | ||||||
|  |       "amdgpu.modeset=1" | ||||||
|  |       "amd_iommu=on" | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     # Blacklist intel and nouveau | ||||||
|  |     boot.blacklistedKernelModules = [ | ||||||
|  |       "nouveau" | ||||||
|  |     ]; | ||||||
|  | 
 | ||||||
|  |     hardware.nvidia = { | ||||||
|  |     # Modesetting is required. | ||||||
|  |     # Add user to extra groups | ||||||
|  |     users.users.andreas = { | ||||||
|  |     extraGroups = [ "video" "render" ]; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  | }; | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user