Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vivaldi: fix patched paths #72207

Merged
merged 3 commits into from Feb 12, 2020
Merged

vivaldi: fix patched paths #72207

merged 3 commits into from Feb 12, 2020

Conversation

@eadwu
Copy link
Member

@eadwu eadwu commented Oct 29, 2019

Doesn't align with the stable version but it's looking like these changes are needed for when 2.9 is released.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@eadwu
Copy link
Member Author

@eadwu eadwu commented Oct 29, 2019

So basically this shouldn't be merged until 2.9 is released.

Copy link
Contributor

@jonringer jonringer left a comment

nix-review passes on NixOS
diff LGTM
not sure how to test

[6 built, 1 copied (0.0 MiB), 0.0 MiB DL]
https://github.com/NixOS/nixpkgs/pull/72207
3 package were build:
exodus vivaldi-ffmpeg-codecs vivaldi-widevine
@betaboon
Copy link
Contributor

@betaboon betaboon commented Nov 7, 2019

@eadwu i just tested this as 9.2 is released. it doesnt quite work.
These are the changes required to make it work:

diff --git a/pkgs/applications/networking/browsers/vivaldi/default.nix b/pkgs/applications/networking/browsers/vivaldi/default.nix
index d203dade224..2a51e46db71 100644
--- a/pkgs/applications/networking/browsers/vivaldi/default.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/default.nix
@@ -81,7 +81,7 @@ in stdenv.mkDerivation rec {
       --suffix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${gtk3.name}/ \
       ${stdenv.lib.optionalString enableWidevine "--suffix LD_LIBRARY_PATH : ${libPath}"}
   '' + stdenv.lib.optionalString enableWidevine ''
-    ln -sf ${vivaldi-widevine}/lib/libwidevinecdm.so $out/opt/${vivaldiName}/WidevineCdm
+    ln -sf ${vivaldi-widevine}/share/google/chrome/WidevineCdm $out/opt/${vivaldiName}/WidevineCdm
   '';

   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix b/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
index cd710cb883d..78b35da1609 100644
--- a/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
@@ -4,11 +4,11 @@

 stdenv.mkDerivation rec {
   name = "chromium-codecs-ffmpeg";
-  version = "77.0.3865.90";
+  version = "78.0.3904.70";

   src = fetchurl {
-    url = "http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_${version}-0ubuntu0.18.04.1_amd64.deb";
-    sha256 = "12736d7x1kqv1727ycx0f1ijbdq2fcc3vwklklnxpkklnf86w51q";
+    url = "http://security.ubuntu.com/ubuntu/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_${version}-0ubuntu0.18.04.2_amd64.deb";
+    sha256 = "1ybzddqqim5q20jk5p0wc5kman58vjd8zj9ccs3hrk7c37hvcd16";
   };

   buildInputs = [ dpkg ];
diff --git a/pkgs/applications/networking/browsers/vivaldi/widevine.nix b/pkgs/applications/networking/browsers/vivaldi/widevine.nix
index fe626b20d4e..f8d5bd609da 100644
--- a/pkgs/applications/networking/browsers/vivaldi/widevine.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/widevine.nix
@@ -14,12 +14,15 @@ stdenv.mkDerivation rec {
   buildInputs = [ unzip ];

   unpackPhase = ''
-    unzip $src libwidevinecdm.so
-    find .
+    unzip $src
   '';

-  installPhase = ''
-    install -vD libwidevinecdm.so $out/lib/libwidevinecdm.so
+  installPhase = let
+    installDir = "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_x64";
+  in ''
+    install -vD libwidevinecdm.so ${installDir}/libwidevinecdm.so
+    install -vD manifest.json ${installDir}/manifest.json
+    install -vD LICENSE.txt ${installDir}/LICENSE.txt
   '';

   meta = with stdenv.lib; {
@eadwu
Copy link
Member Author

@eadwu eadwu commented Nov 7, 2019

Applied patch and rebased onto master.

@eadwu eadwu force-pushed the eadwu:vivaldi/fix-patched-paths branch from 263097f to 3ca23d5 Nov 7, 2019
@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 7, 2019

still all builds fine, @betaboon for testing

@eadwu
Copy link
Member Author

@eadwu eadwu commented Nov 8, 2019

Might be worth noting that if follow vivaldi's specification for whether or not the widevine works [1], none of the two approaches work although they suppress the error.

[1] https://help.vivaldi.com/article/widevinecdm-eme-drm-support-on-linux/

Copy link
Contributor

@betaboon betaboon left a comment

seems to work fine.
i tested with: https://bitmovin.com/demos/drm
and with netflix

@jonringer
Copy link
Contributor

@jonringer jonringer commented Nov 8, 2019

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@AlexeyRaga
Copy link

@AlexeyRaga AlexeyRaga commented Dec 20, 2019

2.10 has been released, would be nice to have the latest version of vivaldi available.

@betaboon
Copy link
Contributor

@betaboon betaboon commented Dec 20, 2019

I didnt notice this PR hasnt been merged yet :/
I'm gonna try to work on a PR for 2.10 and include these changes tomorrow in the train.

@jonringer
Copy link
Contributor

@jonringer jonringer commented Dec 20, 2019

I forgot to follow up after doing the ofborg build

@AlexeyRaga
Copy link

@AlexeyRaga AlexeyRaga commented Dec 21, 2019

Thanks guys!

@eadwu eadwu force-pushed the eadwu:vivaldi/fix-patched-paths branch from 3ca23d5 to b1159b4 Dec 27, 2019
@ofborg ofborg bot requested a review from betaboon Dec 27, 2019
@betaboon
Copy link
Contributor

@betaboon betaboon commented Dec 29, 2019

@eadwu the mirror you're using for ffmpeg does not serve the specified version for me.
I don't see a good reason for not using the mirror that the vivaldi-update-scripts use for fetching the dependencies anyway.

I improved the update-script a little to extract the ffmpeg- and widevine version directly from the update scripts provided by the vivaldi package.

diff --git a/pkgs/applications/networking/browsers/vivaldi/update.sh b/pkgs/applications/networking/browsers/vivaldi/update.sh
index 2e6c2853eb1..b08fe3d7713 100755
--- a/pkgs/applications/networking/browsers/vivaldi/update.sh
+++ b/pkgs/applications/networking/browsers/vivaldi/update.sh
@@ -28,6 +28,7 @@ path=${prefetch[1]}
 nixpkgs="$(git rev-parse --show-toplevel)"
 default_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/default.nix"
 ffmpeg_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix"
+widevine_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/widevine.nix"
 
 (cd "$root" && update-source-version vivaldi "$vivaldi_version" "$hash")
 
@@ -35,12 +36,28 @@ git add "${default_nix}"
 git commit -m "vivaldi: ${vivaldi_version_old} -> ${vivaldi_version}"
 
 # Check vivaldi-ffmpeg-codecs version.
-chromium_version_old=$(version vivaldi-ffmpeg-codecs)
-chromium_version=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/vivaldi-bin | strings | grep '^[0-9]\{2,\}\.[0-9]\+\.[0-9]\{4,\}\+\.[0-9]\+$')
+ffmpeg_version_old=$(version vivaldi-ffmpeg-codecs)
+ffmpeg_version_raw=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg | sed -n -e "s/^FFMPEG_VERSION='\(.*\)'/\1/p")
+ffmpeg_version=$(echo "$ffmpeg_version_raw" | sed -n -e "s/\(.*\)-.*/\1/p")
+ffmpeg_url=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg | sed -n -e 's/^.*FFMPEG_URL="\(.*_amd64.deb\)"/\1/p' | sed "s/\${FFMPEG_VERSION}/$ffmpeg_version_raw/")
 
-if [[ "$chromium_version" != "$chromium_version_old" ]]; then
-  (cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$chromium_version")
+mapfile -t ffmpeg_prefetch < <(nix-prefetch-url --print-path "$ffmpeg_url")
+ffmpeg_hash=${ffmpeg_prefetch[0]}
+ffmpeg_path=${ffmpeg_prefetch[1]}
+
+if [[ "$ffmpeg_version" != "$ffmpeg_version_old" ]]; then
+  (cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$ffmpeg_version" "$ffmpeg_hash" "$ffmpeg_url")
 
   git add "${ffmpeg_nix}"
-  git commit -m "vivaldi-ffmepg-codecs: $chromium_version_old -> $chromium_version"
+  git commit -m "vivaldi-ffmpeg-codecs: $ffmpeg_version_old -> $ffmpeg_version"
+fi
+
+# Check widevine version.
+widevine_version_old=$(version vivaldi-widevine)
+widevine_version=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-widevine | sed -n -e "s/^WIDEVINE_VERSION=\(.*\)/\1/p")
+
+if [[ "$widevine_version" != "$widevine_version_old" ]]; then
+  (cd "$root" && update-source-version vivaldi-widevine "$widevine_version")
+  git add "${widevine_nix}"
+  git commit -m "vivaldi-widevine: $widevine_version_old -> $widevine_version"
 fi
@eadwu
Copy link
Member Author

@eadwu eadwu commented Dec 29, 2019

I don't recall the reason I originally changed it for but I would assume it would have to do with the fact I usually use snapshots and when I extracted the version the link was dead for some reason at the time. I'll change it back.

eadwu added 3 commits Oct 29, 2019
@eadwu eadwu force-pushed the eadwu:vivaldi/fix-patched-paths branch from b1159b4 to 955dfa3 Dec 30, 2019
@AlexeyRaga
Copy link

@AlexeyRaga AlexeyRaga commented Jan 18, 2020

Sorry, I keep bumping it up again, but is this PR ready to be merged of there is still work to be done?

@jonringer
Copy link
Contributor

@jonringer jonringer commented Jan 18, 2020

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@eadwu
Copy link
Member Author

@eadwu eadwu commented Jan 25, 2020

I'll just assume Widevine is correctly installed since I still can't seem to be able to watch Twitch streams. Widevine changes are mainly to fix the metadata issues in chrome://components, as it now shows the version correctly

Widevine Content Decryption Module - Version: 4.10.1582.1
Status - Up-to-date

ffmpeg changes are just fixing it so the file appears in the directory correctly "$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}" from

if [ -e "/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  else
    export LD_PRELOAD="/var/opt/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
  # Allow a way for third party maintainers to provide a suitable file
elif [ -e "$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}"
  else
    export LD_PRELOAD="$HERE/libffmpeg.so.${VIVALDI_VERSION%\.*\.*}"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
elif [ -e "$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so" ]; then
  if [ -n "$LD_PRELOAD" ]; then
    export LD_PRELOAD="$LD_PRELOAD:$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  else
    export LD_PRELOAD="$HOME/.local/lib/vivaldi-snapshot/media-codecs-$CODECS_VERSION/libffmpeg.so"
  fi
  export VIVALDI_FFMPEG_FOUND=YES
else
  echo "'Proprietary media' support is not installed. Fix this by running:" >&2
  echo "    $HERE/update-ffmpeg" >&2
  export VIVALDI_FFMPEG_FOUND=NO
fi

so this PR should be fine now.

@AlexeyRaga
Copy link

@AlexeyRaga AlexeyRaga commented Jan 29, 2020

So it can be merged? ;)

@eadwu
Copy link
Member Author

@eadwu eadwu commented Jan 29, 2020

If nothing else is blocking, then yeah.

@AlexeyRaga
Copy link

@AlexeyRaga AlexeyRaga commented Feb 12, 2020

Vivaldi 2.11 is there ;)

@eadwu
Copy link
Member Author

@eadwu eadwu commented Feb 12, 2020

Don't know whether it's this PR or the updates to vivaldi but Twitch seems to work now.

@jonringer
Copy link
Contributor

@jonringer jonringer commented Feb 12, 2020

@GrahamcOfBorg build exodus vivaldi-ffmpeg-codecs vivaldi-widevine

@jonringer
Copy link
Contributor

@jonringer jonringer commented Feb 12, 2020

seems like this is in a usable state, going to re-verify that it builds on master then merge

@jonringer jonringer merged commit 3480dd6 into NixOS:master Feb 12, 2020
18 checks passed
18 checks passed
exodus, vivaldi-ffmpeg-codecs, vivaldi-widevine on aarch64-linux No attempt
Details
exodus, vivaldi-ffmpeg-codecs, vivaldi-widevine on x86_64-darwin No attempt
Details
vivaldi on aarch64-linux No attempt
Details
vivaldi on x86_64-linux No attempt
Details
Evaluation Performance Report Evaluator Performance Report
Details
exodus, vivaldi-ffmpeg-codecs, vivaldi-widevine on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.