58 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| { 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"
 | |
|     ];
 | |
| 
 | |
|     # Modesetting is required.
 | |
|     # Add user to extra groups
 | |
|     users.users.andreas = {
 | |
|       extraGroups = [ "video" "render" ];
 | |
|     };
 | |
|   };
 | |
| }
 |