at master 2.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 meson, 6 pkg-config, 7 ninja, 8 wayland-scanner, 9 libdrm, 10 minimal ? false, 11 libX11, 12 libxcb, 13 libXext, 14 libXfixes, 15 wayland, 16 libffi, 17 libGL, 18 mesa, 19 # for passthru.tests 20 intel-compute-runtime, 21 intel-media-driver, 22 mpv, 23 intel-vaapi-driver, 24 vlc, 25 testers, 26}: 27 28stdenv.mkDerivation (finalAttrs: { 29 pname = "libva" + lib.optionalString minimal "-minimal"; 30 version = "2.22.0"; 31 32 src = fetchFromGitHub { 33 owner = "intel"; 34 repo = "libva"; 35 rev = finalAttrs.version; 36 sha256 = "sha256-0eOYxyMt2M2lkhoWOhoUQgP/1LYY3QQqSF5TdRUuCbs="; 37 }; 38 39 outputs = [ 40 "dev" 41 "out" 42 ]; 43 44 depsBuildBuild = [ pkg-config ]; 45 46 nativeBuildInputs = [ 47 meson 48 pkg-config 49 ninja 50 ] 51 ++ lib.optional (!minimal) wayland-scanner; 52 53 buildInputs = [ 54 libdrm 55 ] 56 ++ lib.optionals (!minimal) [ 57 libX11 58 libxcb 59 libXext 60 libXfixes 61 wayland 62 libffi 63 libGL 64 ]; 65 66 mesonFlags = lib.optionals stdenv.hostPlatform.isLinux [ 67 # Add FHS and Debian paths for non-NixOS applications 68 "-Ddriverdir=${mesa.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri:/usr/lib/x86_64-linux-gnu/dri:/usr/lib/i386-linux-gnu/dri" 69 ]; 70 71 env = 72 lib.optionalAttrs (stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17") 73 { 74 NIX_LDFLAGS = "--undefined-version"; 75 } 76 // lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { 77 NIX_CFLAGS_COMPILE = "-DHAVE_SECURE_GETENV"; 78 }; 79 80 passthru.tests = { 81 # other drivers depending on libva and selected application users. 82 # Please get a confirmation from the maintainer before adding more applications. 83 inherit 84 intel-compute-runtime 85 intel-media-driver 86 intel-vaapi-driver 87 mpv 88 vlc 89 ; 90 pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 91 }; 92 93 meta = with lib; { 94 description = "Implementation for VA-API (Video Acceleration API)"; 95 longDescription = '' 96 VA-API is an open-source library and API specification, which provides 97 access to graphics hardware acceleration capabilities for video 98 processing. It consists of a main library (this package) and 99 driver-specific acceleration backends for each supported hardware vendor. 100 ''; 101 homepage = "https://01.org/linuxmedia/vaapi"; 102 changelog = "https://raw.githubusercontent.com/intel/libva/${finalAttrs.version}/NEWS"; 103 license = licenses.mit; 104 maintainers = with maintainers; [ SuperSandro2000 ]; 105 pkgConfigModules = [ 106 "libva" 107 "libva-drm" 108 ] 109 ++ lib.optionals (!minimal) [ 110 "libva-glx" 111 "libva-wayland" 112 "libva-x11" 113 ]; 114 platforms = platforms.unix; 115 badPlatforms = [ 116 # Mandatory libva shared library. 117 lib.systems.inspect.platformPatterns.isStatic 118 ]; 119 }; 120})