davinci-resolve: add studioVariant

Resolve wants to write the license to `./.license` in the drv store
path. This obviously fails as it is read-only. Conveniently this is a
Bubblewrap-based FHS env, so we can bind-mount a reasonable dir from
$HOME to this path instead. Unfortunately, the dir needs to exist before
launching, so it must be manually created presently e.g.

    mkdir -p ~/.local/share/DaVinciResolve/license

At least the error is fairly obvious:

> bwrap: Can't find source path /home/user/.local/share/DaVinciResolve/license: No such file or directory

Without making the license writable, license activation will always give
a generic error—the actual problem was found with strace.
This commit is contained in:
Andrew Marshall 2023-09-16 20:21:53 -04:00
parent 7b93c209ef
commit fe45cd375a
2 changed files with 20 additions and 6 deletions

View File

@ -22,12 +22,14 @@
, aprutil
, makeDesktopItem
, copyDesktopItems
, studioVariant ? false
}:
let
davinci = (
stdenv.mkDerivation rec {
pname = "davinci-resolve";
pname = "davinci-resolve${lib.optionalString studioVariant "-studio"}";
version = "18.6";
nativeBuildInputs = [
@ -47,7 +49,10 @@ let
rec {
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-Rxe5ZiLpZbEf6yh7vdIrdjULqE8gyPRarMDDZiWwJCE=";
outputHash =
if studioVariant
then "sha256-QjjVb9IdZ1Vcyw/O3tP9cjxVTfRGC29tkp3KReyz63I="
else "sha256-Rxe5ZiLpZbEf6yh7vdIrdjULqE8gyPRarMDDZiWwJCE=";
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
@ -57,7 +62,10 @@ let
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# Get linux.downloadId from HTTP response on https://www.blackmagicdesign.com/products/davinciresolve
DOWNLOADID = "cebf954f05a74eaeae6b6b14bcca7971";
DOWNLOADID =
if studioVariant
then "2cdeb3d6ccfb4e65add749acb36e659b"
else "cebf954f05a74eaeae6b6b14bcca7971";
REFERID = "263d62f31cbb49e0868005059abcb0c9";
SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}";
@ -77,7 +85,7 @@ let
"street" = "Hogeweide 346";
"state" = "Province of Utrecht";
"city" = "Utrecht";
"product" = "DaVinci Resolve";
"product" = "DaVinci Resolve${if studioVariant then " Studio" else ""}";
};
} ''
@ -112,7 +120,7 @@ let
sourceRoot = ".";
installPhase = let
appimageName = "DaVinci_Resolve_${version}_Linux.run";
appimageName = "DaVinci_Resolve_${lib.optionalString studioVariant "Studio_"}${version}_Linux.run";
in ''
runHook preInstall
@ -165,7 +173,7 @@ let
);
in
buildFHSEnv {
name = "davinci-resolve";
name = davinci.pname;
targetPkgs = pkgs: with pkgs; [
alsa-lib
aprutil
@ -217,6 +225,10 @@ buildFHSEnv {
zlib
];
extraBwrapArgs = lib.optionals studioVariant [
"--bind \"$HOME\"/.local/share/DaVinciResolve/license ${davinci}/.license"
];
runScript = "${bash}/bin/bash ${
writeText "davinci-wrapper"
''

View File

@ -1763,6 +1763,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 { };