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

Package request: widevine-cdm arm64 #220828

Open
schnusch opened this issue Mar 12, 2023 · 4 comments
Open

Package request: widevine-cdm arm64 #220828

schnusch opened this issue Mar 12, 2023 · 4 comments

Comments

@schnusch
Copy link
Contributor

schnusch commented Mar 12, 2023

Project description

It seems widevine is now available for arm64.

raspberrypi/Raspberry-Pi-OS-64bit#248

Metadata

@diamondburned
Copy link

diamondburned commented Sep 11, 2023

Here's my attempt at making Widevine work with Firefox on Asahi Linux M1: diamondburned/dotfiles/Scripts/nix/machines/lilyhoshii/cfg/firefox. I still can't get Spotify to work despite this, but perhaps I'm missing something.

At the very least, Firefox seems to see that the addon is there:

image

A lot of this code is also based on #251085.

This is the furthest that I'm able to get :(

image

@liarokapisv
Copy link
Contributor

@diamondburned Had any progress with this ?

@liarokapisv
Copy link
Contributor

liarokapisv commented Feb 21, 2024

I managed to make widevine work on aarch64 using the same sources and commands as the asahi widevine installer.
I think one could avoid downloading the whole chromeos image.
I will make a PR when I find more free time. In the meantime:

{ stdenvNoCC
, fetchFromGitHub
, fetchurl
, python3
, squashfsTools
, nspr
}:
let
  widevine-installer = fetchFromGitHub {
    owner = "AsahiLinux";
    repo = "widevine-installer";
    rev = "7a3928fe1342fb07d96f61c2b094e3287588958b";
    sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y=";
  };
  lacros-image = fetchurl {
    url =
      let
        distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles";
        lacros_name = "chromeos-lacros-arm64-squash-zstd";
        lacrosVersion = "120.0.6098.0";
      in
      "${distfiles_base}/${lacros_name}-${lacrosVersion}";
    hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY=";
  };
in
stdenvNoCC.mkDerivation {
  name = "widevine";
  version = "4.10.2662.3";

  dontUnpack = true;
  dontBuild = true;

  buildInputs = [ python3 squashfsTools ];

  installPhase = ''
    mkdir $out
    unsquashfs -q ${lacros-image} 'WidevineCdm/*'
    python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so
    mv squashfs-root/WidevineCdm/manifest.json $out/
    mv squashfs-root/WidevineCdm/LICENSE $out/
    patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so 
  '';
}

This will propably need some structural adapting to play well with the expected browser formats.
For example, firefox should be:

  programs.firefox.profiles.default.settings = {
    "media.gmp-widevinecdm.version" = pkgs.widevinecdm-aarch64.version;
    "media.gmp-widevinecdm.visible" = true;
    "media.gmp-widevinecdm.enabled" = true;
    "media.gmp-widevinecdm.autoupdate" = false;
    "media.eme.enabled" = true;
    "media.eme.encrypted-media-encryption-scheme.enabled" = true;
  };

  home.file."firefox-widevinecdm" = {
    enable = true;
    target = ".mozilla/firefox/default/gmp-widevinecdm";
    source = pkgs.runCommandLocal "firefox-widevinecdm" { } ''
      out=$out/${pkgs.widevinecdm-aarch64.version}
      mkdir -p $out
      ln -s ${pkgs.widevinecdm-aarch64}/manifest.json $out/manifest.json
      ln -s ${pkgs.widevinecdm-aarch64}/libwidevinecdm.so $out/libwidevinecdm.so
    '';
    recursive = true;
  };

@dxwil
Copy link
Contributor

dxwil commented Aug 25, 2024

#337261

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants