{ config, pkgs, ... }:

{
  boot.initrd.kernelModules = [ "amdgpu" ];

  # Enable amdgpu
  services.xserver = {
    videoDrivers = [ "amdgpu" ];
    deviceSection = ''Option "TearFree" "true"'';
  };  

  hardware.graphics = {
    enable = true;
    enable32Bit = true;
  };

  # Enable AMDVLK and OpenCL
  hardware.graphics.extraPackages = with pkgs; [
    amdvlk
    rocmPackages.clr.icd
  ];

  hardware.graphics.extraPackages32 = with pkgs; [
    driversi686Linux.amdvlk
  ];

  environment.systemPackages = with pkgs; [
  lact            # Linux AMDGPU Controller
  hwdata          # Hardware Database, including Monitors, pci.ids, usb.ids, and video cards
  libdrm
  vulkan-loader
  vulkan-tools
  vkbasalt
  radeontop
  xorg.xf86videoamdgpu
  ];

  systemd.packages = with pkgs; [ lact ];
  systemd.services.lactd.wantedBy = ["multi-user.target"];
}
