decklink: update to 12.5

authored by railwit.ch and committed by Jörg Thalheim 08f93ba6 59271eba

+78 -24
+9 -7
pkgs/os-specific/linux/decklink/default.nix
··· 1 - { stdenv, lib, requireFile, fetchpatch, kernel }: 1 + { stdenv 2 + , lib 3 + , blackmagic-desktop-video 4 + , kernel 5 + }: 2 6 3 7 stdenv.mkDerivation rec { 4 8 pname = "decklink"; 5 - version = "12.2a12"; 6 9 7 - src = requireFile { 8 - name = "Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}.tar.gz"; 9 - url = "https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux"; 10 - sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; 11 - }; 10 + # the download is a horrible curl mess. we reuse it between the kernel module 11 + # and desktop service, since the version of the two have to match anyways. 12 + # See pkgs/tools/video/blackmagic-desktop-video/default.nix for more. 13 + inherit (blackmagic-desktop-video) src version; 12 14 13 15 KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; 14 16 INSTALL_MOD_PATH = placeholder "out";
+69 -17
pkgs/tools/video/blackmagic-desktop-video/default.nix
··· 1 - { stdenv, requireFile, lib, 2 - libcxx, libcxxabi 1 + { stdenv 2 + , cacert 3 + , curl 4 + , runCommandLocal 5 + , lib 6 + , autoPatchelfHook 7 + , libcxx 8 + , libcxxabi 9 + , libGL 10 + , gcc7 3 11 }: 4 12 5 13 stdenv.mkDerivation rec { 6 14 pname = "blackmagic-desktop-video"; 7 - version = "12.2a12"; 15 + version = "12.5a15"; 8 16 9 17 buildInputs = [ 10 - libcxx libcxxabi 18 + autoPatchelfHook 19 + libcxx 20 + libcxxabi 21 + libGL 22 + gcc7.cc.lib 11 23 ]; 12 24 13 - src = requireFile { 14 - name = "Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}.tar.gz"; 15 - url = "https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux"; 16 - sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; 17 - }; 25 + # yes, the below download function is an absolute mess. 26 + # blame blackmagicdesign. 27 + src = runCommandLocal "${pname}-${lib.versions.majorMinor version}-src.tar.gz" 28 + rec { 29 + outputHashMode = "recursive"; 30 + outputHashAlgo = "sha256"; 31 + outputHash = "sha256-ss7Ab5dy7cmXp9LBirFXMeGY4ZbYHvWnXmYvNeBq0RY="; 32 + 33 + impureEnvVars = lib.fetchers.proxyImpureEnvVars; 34 + 35 + nativeBuildInputs = [ curl ]; 36 + 37 + # ENV VARS 38 + SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 39 + 40 + # from the URL that the POST happens to, see browser console 41 + DOWNLOADID = "fecacc0f9b2f4c2e8bf2863e9e26c8e1"; 42 + # from the URL the download page where you click the "only download" button is at 43 + REFERID = "052d944af6744608b27da496dfc4396d"; 44 + SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}"; 45 + 46 + USERAGENT = builtins.concatStringsSep " " [ 47 + "User-Agent: Mozilla/5.0 (X11; Linux ${stdenv.targetPlatform.linuxArch})" 48 + "AppleWebKit/537.36 (KHTML, like Gecko)" 49 + "Chrome/77.0.3865.75" 50 + "Safari/537.36" 51 + ]; 52 + 53 + REQJSON = builtins.toJSON { 54 + "country" = "nl"; 55 + "downloadOnly" = true; 56 + "platform" = "Linux"; 57 + "policy" = true; 58 + }; 59 + 60 + } '' 61 + RESOLVEURL=$(curl \ 62 + -s \ 63 + -H "$USERAGENT" \ 64 + -H 'Content-Type: application/json;charset=UTF-8' \ 65 + -H "Referer: https://www.blackmagicdesign.com/support/download/$REFERID/Linux" \ 66 + --data-ascii "$REQJSON" \ 67 + --compressed \ 68 + "$SITEURL") 69 + 70 + curl \ 71 + --retry 3 --retry-delay 3 \ 72 + --compressed \ 73 + "$RESOLVEURL" \ 74 + > $out 75 + ''; 18 76 19 77 postUnpack = '' 20 78 tar xf Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}/other/${stdenv.hostPlatform.uname.processor}/desktopvideo-${version}-${stdenv.hostPlatform.uname.processor}.tar.gz ··· 28 86 cp -r $unpacked/usr/share/doc/desktopvideo $out/share/doc 29 87 cp $unpacked/usr/lib/*.so $out/lib 30 88 cp $unpacked/usr/lib/systemd/system/DesktopVideoHelper.service $out/lib/systemd/system 31 - ln -s ${libcxx}/lib/* ${libcxxabi}/lib/* $out/lib 32 - cp $unpacked/usr/lib/blackmagic/DesktopVideo/libgcc_s.so.1 $out/lib/ 33 89 cp $unpacked/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper $out/bin/ 34 90 35 91 substituteInPlace $out/lib/systemd/system/DesktopVideoHelper.service --replace "/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper" "$out/bin/DesktopVideoHelper" ··· 37 93 runHook postInstall 38 94 ''; 39 95 40 - 41 - postFixup = '' 42 - patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \ 43 - --set-rpath "$out/lib:${lib.makeLibraryPath [ libcxx libcxxabi ]}" \ 44 - $out/bin/DesktopVideoHelper 45 - ''; 96 + # i know this is ugly, but it's the cleanest way i found to tell the DesktopVideoHelper where to find its own library 97 + appendRunpaths = [ "$ORIGIN/../lib" ]; 46 98 47 99 meta = with lib; { 48 100 homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback";