Getting AMF transcoding working with ffmpeg

Hi All, I have had a lot of trouble getting AMF transcoding working on my server. I know that the driver must be loaded in some capacity since VAAPI transcoding seems to work fine. I’ve tried doing different configurations and I seem to constantly get AMF failed to initialise on the given Vulkan device: 1. when i tried transcoding.

Here are the relevant parts of my configuration.nix.

let
  customOverlay = self: super: {
  amf-libs = super.stdenv.mkDerivation rec {
    pname = "amf-libs";
    version = "latest";

  src = super.fetchFromGitHub {
    owner = "GPUOpen-LibrariesAndSDKs";
    repo = "AMF";
    rev = "v${version}";
    sha256 = "sha256-eShqo5EBbhl2Us4feFjiX+NfEl1OQ2jPQUC+Hlm+yFs=";
  };

  installPhase = ''
    mkdir -p $out/include/AMF
    cp -r amf/public/include/* $out/include/AMF
  '';


  };


  ffmpeg-full = super.ffmpeg-full.overrideAttrs (oldAttrs: rec {
    nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ self.amf-libs ];
    buildInputs = oldAttrs.buildInputs ++ [ self.amf-libs ];
    configureFlags = oldAttrs.configureFlags ++ [
      "--enable-amf"
      "--extra-cflags=-I${super.pkgs.linuxKernel.packages.linux_zen.amdgpu-pro}/opt/amdgpu-pro/lib"
      #"--extra-ldflags=-L${super.pkgs.amdgpu-pro}/lib"
      "--extra-ldflags=-L${super.pkgs.linuxKernel.packages.linux_zen.amdgpu-pro}/opt/amdgpu-pro/lib"
    ];
  });
  };
  in
{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  nixpkgs.overlays = [ customOverlay ];

  environment.systemPackages = with pkgs; [
     vim 
     wget
     neovim
     makemkv
     conda
     iperf
     openjdk17
     tmux
     lsof
     hpe-ltfs
     mt-st
     parted
     wireguard-tools
     smartmontools
     parallel
     doas
     mesa
     libva
     libva-utils
     vdpauinfo
     linuxKernel.packages.linux_xanmod_latest.amdgpu-pro
     ffmpeg-full
     vulkan-tools
     amdvlk
   ];

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
    extraPackages = with pkgs; [ mesa vaapiVdpau amdvlk  linuxKernel.packages.linux_xanmod_latest.amdgpu-pro ];
  };

  environment.variables = {
    LD_LIBRARY_PATH = "/home/tombert/amdgpu-pro/lib";
    VK_ICD_FILENAMES= "/run/opengl-driver/share/vulkan/icd.d/amd_icd64.json";
  };

If anyone sees that I’m doing some dumb, or has a working amf config that they can share, it would be really helpful.