Unverified Commit 270ec701 authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

vivaldi-ffmpeg-codecs: vivaldi-ffmpeg-codecs: 115541 -> 119239; add aarch64-linux (#398013)

parents fe24d852 05dbf8a1
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
{
  squashfsTools,
  fetchurl,
  lib,
  squashfsTools,
  stdenv,
}:

# This derivation roughly follows the update-ffmpeg script that ships with the official Vivaldi
# downloads at https://vivaldi.com/download/

let
  sources = {
    x86_64-linux = fetchurl {
      url = "https://api.snapcraft.io/api/v1/snaps/download/XXzVIXswXKHqlUATPqGCj2w2l7BxosS8_73.snap";
      hash = "sha256-YsAYQ/fKlrvu7IbIxLO0oVhWOtZZzUmA00lrU+z/0+s=";
    };
    aarch64-linux = fetchurl {
      url = "https://api.snapcraft.io/api/v1/snaps/download/XXzVIXswXKHqlUATPqGCj2w2l7BxosS8_74.snap";
      hash = "sha256-zwCbaFeVmeHQLEp7nmD8VlEjSY9PqSVt6CdW4wPtw9o=";
    };
  };
in
stdenv.mkDerivation rec {

  pname = "chromium-codecs-ffmpeg-extra";
  version = "115541";

  src = fetchurl {
    url = "https://api.snapcraft.io/api/v1/snaps/download/XXzVIXswXKHqlUATPqGCj2w2l7BxosS8_41.snap";
    hash = "sha256-a1peHhku+OaGvPyChvLdh6/7zT+v8OHNwt60QUq7VvU=";
  };
  version = "119293";

  src = sources."${stdenv.hostPlatform.system}";

  buildInputs = [ squashfsTools ];

@@ -26,8 +38,13 @@ stdenv.mkDerivation rec {
    install -vD chromium-ffmpeg-${version}/chromium-ffmpeg/libffmpeg.so $out/lib/libffmpeg.so
  '';

  passthru = {
    inherit sources;
    updateScript = ./update.sh;
  };

  meta = with lib; {
    description = "Additional support for proprietary codecs for Vivaldi";
    description = "Additional support for proprietary codecs for Vivaldi and other chromium based tools";
    homepage = "https://ffmpeg.org/";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.lgpl21;
@@ -35,7 +52,11 @@ stdenv.mkDerivation rec {
      betaboon
      cawilliamson
      fptje
      sarahec
    ];
    platforms = [
      "x86_64-linux"
      "aarch64-linux"
    ];
    platforms = [ "x86_64-linux" ];
  };
}
+44 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils grep jq squashfsTools

set -eu -o pipefail

RELEASES=$(curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/chromium-ffmpeg)
STABLE_RELEASES=$(echo $RELEASES | jq '."channel-map" | .[] | select(.channel.risk=="stable")')

function max_version() {
  local versions=$(echo $1 | jq -r '.version')
  echo "$(echo $versions |  grep -E -o '^[0-9]+')"
}

function update_source() {
  local platform=$1
  local selectedRelease=$2
  local version=$3
  local url=$(echo $selectedRelease | jq -r '.download.url')
  source="$(nix-prefetch-url "$url")"
  hash=$(nix-hash --to-sri --type sha256 "$source")
  update-source-version vivaldi-ffmpeg-codecs "$version" "$hash" "$url" --ignore-same-version --system=$platform --source-key="sources.$platform"
}

x86Release="$(echo $STABLE_RELEASES | jq 'select(.channel.architecture=="amd64")')"
x86CodecVersion=$(max_version "$x86Release")
arm64Release="$(echo $STABLE_RELEASES | jq -r 'select(.channel.architecture=="arm64")')"
arm64CodecVersion=$(max_version "$arm64Release")

currentVersion=$(nix-instantiate --eval -E "with import ./. {}; vivaldi-ffmpeg-codecs.version or (lib.getVersion vivaldi-ffmpeg-codecs)" | tr -d '"')

if [[ "$currentVersion" == "$x86CodecVersion" ]]; then
  exit 0
fi

# If this fails too often, consider finding the max common version between the two architectures
if [[ "$x86CodecVersion" != "$arm64CodecVersion" ]]; then
    >&2 echo "Multiple chromium versions found: $x86CodecVersion (intel) and $arm64CodecVersion (arm); no update"
    exit 1
fi



update_source "x86_64-linux" "$x86Release" "$x86CodecVersion"
update_source "aarch64-linux" "$arm64Release" "$arm64CodecVersion"
+0 −4
Original line number Diff line number Diff line
@@ -15693,10 +15693,6 @@ with pkgs;
  vivaldi = callPackage ../applications/networking/browsers/vivaldi { };
  vivaldi-ffmpeg-codecs =
    callPackage ../applications/networking/browsers/vivaldi/ffmpeg-codecs.nix
      { };
  openrazer-daemon = python3Packages.toPythonApplication python3Packages.openrazer-daemon;
  orpie = callPackage ../applications/misc/orpie {