|
| 1 | +{ |
| 2 | + stdenv, |
| 3 | + fetchurl, |
| 4 | + autoPatchelfHook, |
| 5 | + dpkg, |
| 6 | + makeBinaryWrapper, |
| 7 | + libgcc, |
| 8 | + glib, |
| 9 | + nss, |
| 10 | + nspr, |
| 11 | + at-spi2-atk, |
| 12 | + cups, |
| 13 | + libdrm, |
| 14 | + gtk3, |
| 15 | + pango, |
| 16 | + cairo, |
| 17 | + libgbm, |
| 18 | + expat, |
| 19 | + libxkbcommon, |
| 20 | + alsa-lib, |
| 21 | + libva-minimal, |
| 22 | + pulseaudio, |
| 23 | + libGL, |
| 24 | + vulkan-loader, |
| 25 | + curlWithGnuTls, |
| 26 | + xorg, |
| 27 | + lib, |
| 28 | + libnotify, |
| 29 | + libappindicator-gtk3, |
| 30 | + systemd, |
| 31 | + pciutils, |
| 32 | +}: |
| 33 | +let |
| 34 | + xorgDeps = with xorg; [ |
| 35 | + libXdamage |
| 36 | + libXext |
| 37 | + libXfixes |
| 38 | + libXcomposite |
| 39 | + libXrandr |
| 40 | + ]; |
| 41 | + |
| 42 | + deps = [ |
| 43 | + libgcc.lib |
| 44 | + glib |
| 45 | + nss |
| 46 | + nspr |
| 47 | + at-spi2-atk |
| 48 | + cups |
| 49 | + libdrm |
| 50 | + gtk3 |
| 51 | + pango |
| 52 | + cairo |
| 53 | + libgbm |
| 54 | + expat |
| 55 | + libxkbcommon |
| 56 | + alsa-lib |
| 57 | + libva-minimal |
| 58 | + pulseaudio |
| 59 | + libGL |
| 60 | + vulkan-loader |
| 61 | + curlWithGnuTls |
| 62 | + ] ++ xorgDeps; |
| 63 | + |
| 64 | + libPath = lib.makeLibraryPath deps + ":" + lib.makeSearchPathOutput "lib" "lib64" deps; |
| 65 | + binPath = lib.makeBinPath deps; |
| 66 | +in |
| 67 | +stdenv.mkDerivation (finalAttrs: { |
| 68 | + pname = "airtame-application"; |
| 69 | + version = "4.12.0"; |
| 70 | + |
| 71 | + src = fetchurl { |
| 72 | + url = "https://downloads.airtame.com/app/latest/linux/Airtame-${finalAttrs.version}.deb"; |
| 73 | + hash = "sha256-HTqJ637iPtiReFLoGdgKkpxW0UGRPvLjgMMcVV+cRfY="; |
| 74 | + }; |
| 75 | + |
| 76 | + nativeBuildInputs = [ |
| 77 | + autoPatchelfHook |
| 78 | + dpkg |
| 79 | + makeBinaryWrapper |
| 80 | + ]; |
| 81 | + |
| 82 | + buildInputs = deps; |
| 83 | + runtimeDependencies = [ |
| 84 | + (lib.getLib systemd) |
| 85 | + libnotify |
| 86 | + libappindicator-gtk3 |
| 87 | + pulseaudio |
| 88 | + pciutils |
| 89 | + ]; |
| 90 | + |
| 91 | + dontConfigure = true; |
| 92 | + dontBuild = true; |
| 93 | + |
| 94 | + installPhase = '' |
| 95 | + runHook preInstall |
| 96 | +
|
| 97 | + mkdir -p $out/{bin,share/Airtame} |
| 98 | + mv usr/share/* $out/share |
| 99 | + mv opt/Airtame/* $out/share/Airtame |
| 100 | +
|
| 101 | + # Ensure ANGLE libGLESv2.so finds libGL and libvulkan. |
| 102 | + ln -sf ${lib.getLib vulkan-loader}/lib/libvulkan.so.1 $out/share/Airtame/libvulkan.so.1 |
| 103 | + patchelf $out/share/Airtame/lib*GL* --set-rpath ${libPath} |
| 104 | +
|
| 105 | + for elf in $out/share/Airtame/{chrome-sandbox,chrome_crashpad_handler}; do |
| 106 | + patchelf $elf --set-rpath ${libPath} --set-interpreter ${stdenv.cc.bintools.dynamicLinker} |
| 107 | + done |
| 108 | +
|
| 109 | + makeBinaryWrapper $out/share/Airtame/airtame-application $out/bin/airtame-application \ |
| 110 | + --prefix LD_LIBRARY_PATH : ${libPath} \ |
| 111 | + --prefix PATH : ${binPath} |
| 112 | +
|
| 113 | + # Install licenses. |
| 114 | + install -m 644 -D $out/share/Airtame/LICENSE.electron.txt $out/share/licenses/airtame-application/LICENSE.electron.txt |
| 115 | + install -m 644 -D $out/share/Airtame/LICENSES.chromium.html $out/share/licenses/airtame-application/LICENSES.chromium.html |
| 116 | +
|
| 117 | + # Fix the Exec path in the .desktop file. |
| 118 | + sed -i "s|Exec.*$|Exec=$out/bin/airtame-application \$U|" $out/share/applications/airtame-application.desktop |
| 119 | +
|
| 120 | + runHook postInstall |
| 121 | + ''; |
| 122 | + |
| 123 | + meta = { |
| 124 | + description = "Airtame official screen streaming application"; |
| 125 | + homepage = "https://airtame.com"; |
| 126 | + downloadPage = "https://downloads.airtame.com/app/latest/linux/Airtame-${finalAttrs.version}.deb"; |
| 127 | + mainProgram = "airtame-application"; |
| 128 | + license = lib.licenses.unfree; |
| 129 | + platforms = lib.platforms.linux; |
| 130 | + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; |
| 131 | + maintainers = with lib.maintainers; [ BastianAsmussen ]; |
| 132 | + }; |
| 133 | +}) |
0 commit comments