Skip to content

Commit

Permalink
Merge pull request #255577 from amarshall/davinci-resolve
Browse files Browse the repository at this point in the history
davinci-resolve: 18.5.1 -> 18.6.2; add studio variant; various improvements
  • Loading branch information
pbsds committed Dec 2, 2023
2 parents 6e08bfc + f1361c5 commit 669b964
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
50 changes: 38 additions & 12 deletions pkgs/applications/video/davinci-resolve/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
, aprutil
, makeDesktopItem
, copyDesktopItems
, jq

, studioVariant ? false
}:

let
davinci = (
stdenv.mkDerivation rec {
pname = "davinci-resolve";
version = "18.5.1";
pname = "davinci-resolve${lib.optionalString studioVariant "-studio"}";
version = "18.6.3";

nativeBuildInputs = [
(appimage-run.override { buildFHSEnv = buildFHSEnvChroot; } )
Expand All @@ -47,19 +50,24 @@ let
rec {
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-AZ869hA/WeCf3sxhdDOzD/q30P1NaD18TheBtS1ammQ=";
outputHash =
if studioVariant
then "sha256-OX8PyMhfl0jRdXBNsjlwkCAh8XUNJv8HEbmyAdjIv18="
else "sha256-PNzdVxGgXIHM2vi3ChHx67TQBFlCYBOZCiFkDi/RSu4=";

impureEnvVars = lib.fetchers.proxyImpureEnvVars;

nativeBuildInputs = [ curl ];
nativeBuildInputs = [ curl jq ];

# ENV VARS
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";

# Get linux.downloadId from HTTP response on https://www.blackmagicdesign.com/products/davinciresolve
DOWNLOADID = "defc1c6789b7475b9ee4a42daf9ba61d";
REFERID = "263d62f31cbb49e0868005059abcb0c9";
SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}";
DOWNLOADSURL = "https://www.blackmagicdesign.com/api/support/us/downloads.json";
SITEURL = "https://www.blackmagicdesign.com/api/register/us/download";
PRODUCT = "DaVinci Resolve${lib.optionalString studioVariant " Studio"}";
VERSION = version;

USERAGENT = builtins.concatStringsSep " " [
"User-Agent: Mozilla/5.0 (X11; Linux ${stdenv.hostPlatform.linuxArch})"
Expand All @@ -77,10 +85,16 @@ let
"street" = "Hogeweide 346";
"state" = "Province of Utrecht";
"city" = "Utrecht";
"product" = "DaVinci Resolve";
"product" = PRODUCT;
};

} ''
DOWNLOADID=$(
curl --silent --compressed "$DOWNLOADSURL" \
| jq --raw-output '.downloads[] | select(.name | test("^'"$PRODUCT $VERSION"'( Update)?$")) | .urls.Linux[0].downloadId'
)
echo "downloadid is $DOWNLOADID"
test -n "$DOWNLOADID"
RESOLVEURL=$(curl \
--silent \
--header 'Host: www.blackmagicdesign.com' \
Expand All @@ -95,7 +109,7 @@ let
--header 'Cookie: _ga=GA1.2.1849503966.1518103294; _gid=GA1.2.953840595.1518103294' \
--data-ascii "$REQJSON" \
--compressed \
"$SITEURL")
"$SITEURL/$DOWNLOADID")
curl \
--retry 3 --retry-delay 3 \
Expand All @@ -111,14 +125,17 @@ let
# The unpack phase won't generate a directory
sourceRoot = ".";

installPhase = ''
installPhase = let
appimageName = "DaVinci_Resolve_${lib.optionalString studioVariant "Studio_"}${version}_Linux.run";
in ''
runHook preInstall
export HOME=$PWD/home
mkdir -p $HOME
mkdir -p $out
appimage-run ./DaVinci_Resolve_${version}_Linux.run -i -y -n -C $out
test -e ${lib.escapeShellArg appimageName}
appimage-run ${lib.escapeShellArg appimageName} -i -y -n -C $out
mkdir -p $out/{configs,DolbyVision,easyDCP,Fairlight,GPUCache,logs,Media,"Resolve Disk Database",.crashreport,.license,.LUT}
runHook postInstall
Expand Down Expand Up @@ -162,7 +179,9 @@ let
);
in
buildFHSEnv {
name = "davinci-resolve";
inherit (davinci) pname version;
name = null;

targetPkgs = pkgs: with pkgs; [
alsa-lib
aprutil
Expand Down Expand Up @@ -201,6 +220,7 @@ buildFHSEnv {
xorg.libXinerama
xorg.libXrandr
xorg.libXrender
xorg.libXt
xorg.libXtst
xorg.libXxf86vm
xorg.libxcb
Expand All @@ -213,16 +233,22 @@ buildFHSEnv {
zlib
];

extraBwrapArgs = lib.optionals studioVariant [
"--bind \"$HOME\"/.local/share/DaVinciResolve/license ${davinci}/.license"
];

runScript = "${bash}/bin/bash ${
writeText "davinci-wrapper"
''
export QT_XKB_CONFIG_ROOT="${xkeyboard_config}/share/X11/xkb"
export QT_PLUGIN_PATH="${davinci}/libs/plugins:$QT_PLUGIN_PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${davinci}/libs
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib32:${davinci}/libs
${davinci}/bin/resolve
''
}";

passthru = { inherit davinci; };

meta = with lib; {
description = "Professional video editing, color, effects and audio post-processing";
homepage = "https://www.blackmagicdesign.com/products/davinciresolve";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,8 @@ with pkgs;

davinci-resolve = callPackage ../applications/video/davinci-resolve { };

davinci-resolve-studio = callPackage ../applications/video/davinci-resolve { studioVariant = true; };

dolbybcsoftwaredecode = callPackage ../applications/audio/dolbybcsoftwaredecode { };

donkey = callPackage ../tools/security/donkey { };
Expand Down

0 comments on commit 669b964

Please sign in to comment.