Skip to content

GodTamIt/amd-ama-nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amd-ama-nix

Nix flake that packages AMD's Advanced Media Acceleration (AMA) SDK for NixOS — primarily for the Alveo MA35D card.

Tracks SDK release v1.4.0 (2025-12-17). All binaries are fetched from AMD's official apt feed (packages.xilinx.com/artifactory/debian-packages); nothing is vendored in this repo.

What you get

Package Source Description
amd-ama-firmware amd-ama-driver.deb The 8 ama_fw_*.bin blobs that the kernel module loads.
amd-ama-runtime amd-ama-core.deb Prebuilt libvpi, libxrm, headers. Patchelf'd for NixOS.
amd-ama-kmod amd-ama-driver.deb (kmod.tar.gz) Out-of-tree ama_transcoder.ko, built against your kernel.
amd-ama-ffmpeg amd-ama-ffmpeg-src.deb FFmpeg 7.1 with AMD's VPE/AMA patches + a full codec set.

Quick start

Add the flake to another flake's inputs and import the NixOS module:

{
  inputs.amd-ama.url = "github:GodTamIt/amd-ama-nix";

  outputs = { self, nixpkgs, amd-ama, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        amd-ama.nixosModules.default
        ({ ... }: {
          nixpkgs.config.allowUnfree = true; # runtime libs are redistributable-unfree
          hardware.amd-ama.enable = true;
        })
        ./configuration.nix
      ];
    };
  };
}

That gives you:

  • ama_transcoder.ko auto-loaded at boot, firmware staged in /lib/firmware/
  • PCI reset-method / SR-IOV autoprobe tweaks applied via udev
  • ffmpeg-ama (the AMA-patched build) on the system PATH, installed side-by-side with whatever pkgs.ffmpeg you already have

To install one-off via nix run:

$ nix run github:GodTamIt/amd-ama-nix -- -hide_banner -codecs | grep _ama

FFmpeg build — what's enabled

The FFmpeg derivation enables the same external codecs as pkgs.ffmpeg-full, on top of AMD's AMA plugins:

  • AMA (via libvpi + libxrm)h264_ama, hevc_ama, av1_ama, vp9_ama, jpeg_ama, ljpeg_ama and the matching filters.
  • Video codecs — libx264, libvpx (VP8/VP9), libaom (AV1 enc), libdav1d (AV1 dec), libopenh264, libtheora, libwebp.
  • Audio codecs — libopus, libvorbis, libmp3lame, libspeex.
  • HW accel (independent of AMA) — VAAPI, VDPAU, libdrm. Useful on mixed systems (e.g. AMD APU + MA35D card).
  • Audio I/O — ALSA, PulseAudio.
  • Containers / misc — libass, libbluray, lzma, libxml2 (DASH), OpenSSL, libsrt, libzmq, libfreetype / libfontconfig / libfribidi / libharfbuzz.

Not enabled:

  • libx265 — nixpkgs ships 4.1 which breaks the API that AMD's FFmpeg 7.1 expects. Use hevc_ama instead, or add a pinned older x265 via extraConfigureFlags + extraBuildInputs.

  • libsvt-av1 — same story, nixpkgs has 3.x with an incompatible signature. Use av1_ama or libaom.

  • libfdk-aac — nonfree, opt-in:

    (amd-ama.packages.x86_64-linux.amd-ama-ffmpeg.override {
      withNonfree = true;
      fdk_aac = pkgs.fdk_aac;
    })

Want more? extraConfigureFlags and extraBuildInputs are plumbed through:

amd-ama.packages.x86_64-linux.amd-ama-ffmpeg.override {
  extraBuildInputs = [ pkgs.libjxl ];
  extraConfigureFlags = [ "--enable-libjxl" ];
}

Binary name

By default the package installs bin/ffmpeg-ama and bin/ffprobe-ama so it cannot collide with pkgs.ffmpeg. Three ways to change that:

As a module option (most users):

hardware.amd-ama = {
  enable = true;
  ffmpegBinaryName = "ffmpeg";   # → bin/ffmpeg + bin/ffprobe
};

If you do this, don't also have pkgs.ffmpeg in your environment.systemPackages — NixOS will refuse the activation with a bin/ffmpeg collision.

As a package override (if you're pulling the package in yourself rather than using the module):

environment.systemPackages = [
  (amd-ama.packages.x86_64-linux.amd-ama-ffmpeg.override {
    binaryName = "ffmpeg";
  })
];

Opt out of installing ffmpeg entirely — the kernel module and firmware are still wired up, but the binary isn't placed on PATH:

hardware.amd-ama = {
  enable = true;
  installFfmpeg = false;
};

The ffprobe binary is always renamed in lockstep: ffmpeg-amaffprobe-ama, ffmpegffprobe, foofooprobe (via a simple s/ffmpeg/ffprobe/ substitution).

Kernel support

AMD's driver hasn't been ported past the from_timer / del_timer_sync removals in Linux 6.15/6.16. The default kernel for this flake is 6.12 LTS. If you build against 6.16+ you'll hit compile errors.

To pin a specific kernel inside your system config:

{ config, pkgs, ... }: {
  boot.kernelPackages = pkgs.linuxPackages_6_12;
  hardware.amd-ama.enable = true;
}

Status

  • ✅ Builds on x86_64-linux, nix flake check passes.
  • ffmpeg -codecs lists h264_ama, hevc_ama, av1_ama, vp9_ama, jpeg_ama alongside libx264, libaom, libdav1d, libvpx, libopus, VAAPI, etc.
  • ⏳ No hardware-in-loop test yet. Runtime correctness on an actual MA35D has not been verified.
  • ⏳ XMA / XRM daemons (xrmd, mamgmt, mautil) are not packaged yet. AMD ships them as prebuilt ELFs with non-contiguous PT_NOTE segments that patchelf can't rewrite. Only libvpi and headers are installed today.

Known quirks the flake handles

  • Kernel EXTRA_CFLAGS deprecation — kernel 6.x dropped the legacy name; AMD's Kbuild still uses it. We substituteInPlace it to ccflags-y at patch-time.
  • $(AQROOT) path capture — AMD's Kbuild uses AQROOT which the kernel's inner make doesn't re-export. We swap it for $(M).
  • MODULE_IMPORT_NS(DMA_BUF) — AMD's source has the version guard inverted; the namespace was introduced in 5.16, not 5.15. Patched.
  • nixpkgs apr-1.7.6 missing -lmmodf IFUNC fails to resolve at dlopen, segfaulting ffmpeg startup. We override APR with --add-needed libm.so.6.

Layout

pkgs/
  sources.nix   # pinned upstream URLs + sha256
  firmware.nix  # extracts /lib/firmware/ama_fw_*.bin from the driver deb
  runtime.nix   # libvpi + closure, patchelf'd
  kmod.nix      # out-of-tree kernel module
  ffmpeg.nix    # FFmpeg build
  default.nix   # wires them together (and applies APR fixup)
modules/
  default.nix   # NixOS module (hardware.amd-ama.enable)
flake.nix       # inputs + outputs

About

Nix flake that packages AMD's Advanced Media Acceleration (AMA) SDK for NixOS -- primarily for the Alveo MA35D card.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages