btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / in / intel-media-driver / package.nix
blobded8e57cf1656308266c346c779c9ccbf48563be
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , pkg-config
7 , libva
8 , libpciaccess
9 , intel-gmmlib
10 , libdrm
11 , enableX11 ? stdenv.hostPlatform.isLinux
12 , libX11
13   # for passhtru.tests
14 , pkgsi686Linux
17 stdenv.mkDerivation rec {
18   pname = "intel-media-driver";
19   version = "24.3.4";
21   outputs = [ "out" "dev" ];
23   src = fetchFromGitHub {
24     owner = "intel";
25     repo = "media-driver";
26     rev = "intel-media-${version}";
27     hash = "sha256-vgbWwL4mu8YZzfvBvxna8Ioz6ig29iA2RZHKuHdh5Ic=";
28   };
30   patches = [
31     # fix platform detection
32     (fetchpatch {
33       url = "https://salsa.debian.org/multimedia-team/intel-media-driver-non-free/-/raw/7376a99f060c26d6be8e56674da52a61662617b9/debian/patches/0002-Remove-settings-based-on-ARCH.patch";
34       hash = "sha256-57yePuHWYb3XXrB4MjYO2h6jbqfs4SGTLlLG91el8M4=";
35     })
36   ];
38   cmakeFlags = [
39     "-DINSTALL_DRIVER_SYSCONF=OFF"
40     "-DLIBVA_DRIVERS_PATH=${placeholder "out"}/lib/dri"
41     # Works only on hosts with suitable CPUs.
42     "-DMEDIA_RUN_TEST_SUITE=OFF"
43     "-DMEDIA_BUILD_FATAL_WARNINGS=OFF"
44   ];
46   env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.hostPlatform.system == "i686-linux") "-D_FILE_OFFSET_BITS=64";
48   nativeBuildInputs = [ cmake pkg-config ];
50   buildInputs = [ libva libpciaccess intel-gmmlib libdrm ]
51     ++ lib.optional enableX11 libX11;
53   postFixup = lib.optionalString enableX11 ''
54     patchelf --set-rpath "$(patchelf --print-rpath $out/lib/dri/iHD_drv_video.so):${lib.makeLibraryPath [ libX11 ]}" \
55       $out/lib/dri/iHD_drv_video.so
56   '';
58   passthru.tests = {
59     inherit (pkgsi686Linux) intel-media-driver;
60   };
62   meta = with lib; {
63     description = "Intel Media Driver for VAAPI — Broadwell+ iGPUs";
64     longDescription = ''
65       The Intel Media Driver for VAAPI is a new VA-API (Video Acceleration API)
66       user mode driver supporting hardware accelerated decoding, encoding, and
67       video post processing for GEN based graphics hardware.
68     '';
69     homepage = "https://github.com/intel/media-driver";
70     changelog = "https://github.com/intel/media-driver/releases/tag/intel-media-${version}";
71     license = with licenses; [ bsd3 mit ];
72     platforms = platforms.linux;
73     maintainers = with maintainers; [ SuperSandro2000 ];
74   };