1{ stdenv, lib, fetchFromGitHub, meson, pkg-config, ninja, wayland-scanner
2, libdrm
3, minimal ? false
4, libX11, libXext, libXfixes, wayland, libffi, libGL
5, mesa
6# for passthru.tests
7, intel-compute-runtime
8, intel-media-driver
9, mpv
10, intel-vaapi-driver
11, vlc
12, testers
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "libva" + lib.optionalString minimal "-minimal";
17 version = "2.21.0";
18
19 src = fetchFromGitHub {
20 owner = "intel";
21 repo = "libva";
22 rev = finalAttrs.version;
23 sha256 = "sha256-X9H5nxbYFSMfxZMxs3iWwCgdrJ2FTVWW7tlgQek3WIg=";
24 };
25
26 outputs = [ "dev" "out" ];
27
28 depsBuildBuild = [ pkg-config ];
29
30 nativeBuildInputs = [ meson pkg-config ninja ]
31 ++ lib.optional (!minimal) wayland-scanner;
32
33 buildInputs = [ libdrm ]
34 ++ lib.optionals (!minimal) [ libX11 libXext libXfixes wayland libffi libGL ];
35
36 mesonFlags = [
37 # Add FHS and Debian paths for non-NixOS applications
38 "-Ddriverdir=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri:/usr/lib/x86_64-linux-gnu/dri:/usr/lib/i386-linux-gnu/dri"
39 ];
40
41 passthru.tests = {
42 # other drivers depending on libva and selected application users.
43 # Please get a confirmation from the maintainer before adding more applications.
44 inherit intel-compute-runtime intel-media-driver intel-vaapi-driver mpv vlc;
45 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
46 };
47
48 meta = with lib; {
49 description = "An implementation for VA-API (Video Acceleration API)";
50 longDescription = ''
51 VA-API is an open-source library and API specification, which provides
52 access to graphics hardware acceleration capabilities for video
53 processing. It consists of a main library (this package) and
54 driver-specific acceleration backends for each supported hardware vendor.
55 '';
56 homepage = "https://01.org/linuxmedia/vaapi";
57 changelog = "https://raw.githubusercontent.com/intel/libva/${finalAttrs.version}/NEWS";
58 license = licenses.mit;
59 maintainers = with maintainers; [ SuperSandro2000 ];
60 pkgConfigModules = [ "libva" "libva-drm" ] ++ lib.optionals (!minimal) [
61 "libva-glx" "libva-wayland" "libva-x11"
62 ];
63 platforms = platforms.unix;
64 badPlatforms = [
65 # Mandatory libva shared library.
66 lib.systems.inspect.platformPatterns.isStatic
67 ];
68 };
69})