Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 6 # build 7 cmake, 8 pkg-config, 9 10 # runtime 11 expat, 12 ipu6-camera-bins, 13 libtool, 14 gst_all_1, 15 libdrm, 16 17 # Pick one of 18 # - ipu6 (Tiger Lake) 19 # - ipu6ep (Alder Lake) 20 # - ipu6epmtl (Meteor Lake) 21 ipuVersion ? "ipu6", 22}: 23let 24 ipuTarget = 25 { 26 "ipu6" = "ipu_tgl"; 27 "ipu6ep" = "ipu_adl"; 28 "ipu6epmtl" = "ipu_mtl"; 29 } 30 .${ipuVersion}; 31in 32stdenv.mkDerivation { 33 pname = "${ipuVersion}-camera-hal"; 34 version = "unstable-2024-09-29"; 35 36 src = fetchFromGitHub { 37 owner = "intel"; 38 repo = "ipu6-camera-hal"; 39 rev = "f98f72b156563fe8373e4f8d017a9f609676bb33"; 40 hash = "sha256-zVcgKW7/GHYd1oMvsaI77cPyj3G68dL+OXBJDz5+Td4="; 41 }; 42 43 nativeBuildInputs = [ 44 cmake 45 pkg-config 46 ]; 47 48 cmakeFlags = [ 49 "-DIPU_VER=${ipuVersion}" 50 "-DTARGET_SUFFIX=-${ipuVersion}" 51 # missing libiacss 52 "-DUSE_PG_LITE_PIPE=ON" 53 "-DCMAKE_BUILD_TYPE=Release" 54 "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}" 55 "-DCMAKE_INSTALL_SUB_PATH=${ipuTarget}" 56 "-DCMAKE_INSTALL_LIBDIR=lib" 57 ]; 58 59 NIX_CFLAGS_COMPILE = [ 60 "-Wno-error" 61 ]; 62 63 enableParallelBuilding = true; 64 65 buildInputs = [ 66 expat 67 ipu6-camera-bins 68 libtool 69 gst_all_1.gstreamer 70 gst_all_1.gst-plugins-base 71 libdrm 72 ]; 73 74 postPatch = '' 75 substituteInPlace src/platformdata/PlatformData.h \ 76 --replace '/usr/share/' "${placeholder "out"}/share/" \ 77 --replace '#define CAMERA_DEFAULT_CFG_PATH "/etc/camera/"' '#define CAMERA_DEFAULT_CFG_PATH "${placeholder "out"}/etc/camera/"' 78 ''; 79 80 postInstall = '' 81 mkdir -p $out/include/${ipuTarget}/ 82 cp -r $src/include $out/include/${ipuTarget}/libcamhal 83 ''; 84 85 postFixup = '' 86 for lib in $out/lib/*.so; do 87 patchelf --add-rpath "${ipu6-camera-bins}/lib" $lib 88 done 89 ''; 90 91 passthru = { 92 inherit ipuVersion ipuTarget; 93 }; 94 95 meta = with lib; { 96 description = "HAL for processing of images in userspace"; 97 homepage = "https://github.com/intel/ipu6-camera-hal"; 98 license = licenses.asl20; 99 maintainers = [ ]; 100 platforms = [ "x86_64-linux" ]; 101 }; 102}