{ lib, pkgs, config, ... }:

with lib;
let
  cfg = config.drivers.amdgpu;
in
{
  options.drivers.amdgpu = {
    enable = mkEnableOption "enable amd drivers";
  };

  config = mkIf cfg.enable {
    systemd.tmpfiles.rules = [ "L+    /opt/rocm/hip   -    -    -     -    ${pkgs.rocmPackages.clr}" ];
    services.xserver.videoDrivers = [ "amdgpu" ];

    # opengl
    hardware.graphics = {
      extraPackages = with pkgs; [
        libva
        libva-utils
      ];
    };
  };
}