{ pkgs, lib, ... }:
{
    # Adapted from: https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/amd/default.nix

    # Make the kernel use the correct driver early
    boot.initrd.kernelModules = [ "amdgpu" ];

    # Make sure Xserver uses the `amdgpu` driver
    services.xserver.enable = true;
    services.xserver.videoDrivers = [ "amdgpu" ];

    # For 32 bit applications
    hardware.opengl.driSupport32Bit = true;

    # AMDVLK drivers can be used in addition to the Mesa RADV drivers
    hardware.opengl.extraPackages = with pkgs; [
        amdvlk
        rocmPackages.clr.icd
    ];

    # For 32 bit applications 
    hardware.opengl.extraPackages32 = with pkgs; [
        driversi686Linux.amdvlk
    ];

    environment.systemPackages = with pkgs; [
        nvtop-amd
        clinfo
        rocmPackages.clr
    ];
}
