11 stdenv.mkDerivation (finalAttrs: {
12 pname = "blackmagic-desktop-video";
22 # yes, the below download function is an absolute mess.
23 # blame blackmagicdesign.
26 # from the URL the download page where you click the "only download" button is at
27 REFERID = "b97e55f37a0042fbacd234971d8c93ed";
28 # from the URL that the POST happens to, see browser console
29 DOWNLOADID = "552546307a7c4de29ea6d09a6ca08c90";
31 runCommandLocal "${finalAttrs.pname}-${lib.versions.majorMinor finalAttrs.version}-src.tar.gz"
33 outputHashMode = "recursive";
34 outputHashAlgo = "sha256";
35 outputHash = "sha256-rfZDL1YvAuMD5u68MMyiT8cERsIHMc9K25lXt7cqrrk=";
37 impureEnvVars = lib.fetchers.proxyImpureEnvVars;
39 nativeBuildInputs = [ curl ];
42 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
45 SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}";
47 USERAGENT = builtins.concatStringsSep " " [
48 "User-Agent: Mozilla/5.0 (X11; Linux ${stdenv.hostPlatform.linuxArch})"
49 "AppleWebKit/537.36 (KHTML, like Gecko)"
54 REQJSON = builtins.toJSON {
56 "downloadOnly" = true;
65 -H 'Content-Type: application/json;charset=UTF-8' \
66 -H "Referer: https://www.blackmagicdesign.com/support/download/$REFERID/Linux" \
67 --data-ascii "$REQJSON" \
71 --retry 3 --retry-delay 3 \
79 arch = stdenv.hostPlatform.uname.processor;
82 tar xf Blackmagic_Desktop_Video_Linux_${lib.head (lib.splitString "a" finalAttrs.version)}/other/${arch}/desktopvideo-${finalAttrs.version}-${arch}.tar.gz
83 unpacked=$NIX_BUILD_TOP/desktopvideo-${finalAttrs.version}-${stdenv.hostPlatform.uname.processor}
88 mkdir -p $out/{bin,share/doc,lib/systemd/system}
89 cp -r $unpacked/usr/share/doc/desktopvideo $out/share/doc
90 cp $unpacked/usr/lib/*.so $out/lib
91 cp $unpacked/usr/lib/systemd/system/DesktopVideoHelper.service $out/lib/systemd/system
92 cp $unpacked/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper $out/bin/
93 substituteInPlace $out/lib/systemd/system/DesktopVideoHelper.service \
94 --replace-fail "/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper" "$out/bin/DesktopVideoHelper"
98 # need to tell the DesktopVideoHelper where to find its own library
99 appendRunpaths = [ "${placeholder "out"}/lib" ];
102 homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback";
103 maintainers = [ maintainers.naxdy ];
104 license = licenses.unfree;
105 description = "Supporting applications for Blackmagic Decklink. Doesn't include the desktop applications, only the helper required to make the driver work";
106 platforms = platforms.linux;