wip: aarch64 widevine for helium

This commit is contained in:
Sean Kovacs 2025-11-13 17:00:09 -05:00
commit 7dba6d3bf4
Signed by: sckova
GPG key ID: 00F325187C68651A
8 changed files with 99 additions and 21 deletions

View file

@ -70,9 +70,7 @@
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
nur.overlays.default nur.overlays.default
(import ./packages/widevine-firefox/overlay.nix) (import ./packages/overlay.nix)
(import ./packages/strawberry/overlay.nix)
(import ./packages/helium-browser/overlay.nix)
]; ];
} }
./system/all.nix ./system/all.nix

View file

@ -1,3 +0,0 @@
final: prev: {
helium-browser = prev.callPackage (builtins.path { path = ./package.nix; }) { };
}

View file

@ -1,3 +1,7 @@
# taken (stolen?) from two places:
# https://github.com/fpletz/flake/blob/main/pkgs/by-name/helium-browser.nix
# https://github.com/nix-community/nur-combined/blob/main/repos/Ev357/pkgs/helium/default.nix
# so shoutout those guys
{ {
stdenv, stdenv,
lib, lib,
@ -5,6 +9,7 @@
fetchurl, fetchurl,
makeDesktopItem, makeDesktopItem,
copyDesktopItems, copyDesktopItems,
widevine-helium ? null,
}: }:
let let
pname = "helium-browser"; pname = "helium-browser";
@ -13,7 +18,7 @@ let
architectures = { architectures = {
"x86_64-linux" = { "x86_64-linux" = {
arch = "x86_64"; arch = "x86_64";
hash = lib.fakeHash; hash = "sha256-DlEFuFwx2Qjr9eb6uiSYzM/F3r2hdtkMW5drJyJt/YE=";
}; };
"aarch64-linux" = { "aarch64-linux" = {
arch = "arm64"; arch = "arm64";
@ -30,19 +35,24 @@ let
inherit hash; inherit hash;
}; };
appimageContents = appimageTools.extractType2 { appImageContents = appimageTools.extractType2 { inherit pname version src; };
inherit pname version src;
};
in in
appimageTools.wrapType2 { appimageTools.wrapType2 {
inherit pname version src; inherit pname version src;
extraInstallCommands = '' extraInstallCommands = ''
install -Dm444 ${appimageContents}/helium.desktop -t $out/share/applications mkdir -p "$out/share/applications"
install -Dm444 ${appimageContents}/helium.png -t $out/share/pixmaps mkdir -p "$out/share/lib/helium"
cp -r ${appImageContents}/opt/helium/locales "$out/share/lib/helium"
cp -r ${appImageContents}/usr/share/* "$out/share"
cp "${appImageContents}/helium.desktop" "$out/share/applications/"
substituteInPlace $out/share/applications/helium.desktop \ substituteInPlace $out/share/applications/helium.desktop \
--replace-fail 'Exec=AppRun' 'Exec=${pname}' \ --replace-fail 'Exec=AppRun' 'Exec=${pname} \
--replace-fail 'Icon=helium' 'Icon=web-browser' --replace-fail 'Icon=helium' 'Icon=web-browser
${lib.optionalString (stdenv.hostPlatform.system == "aarch64-linux") ''
cp -r ${widevine-helium}/share/helium/WidevineCdm "$out/share/lib/helium/"
''}
''; '';
meta = { meta = {
description = "A private, respectful browser"; description = "A private, respectful browser";

View file

@ -0,0 +1,49 @@
{
lib,
stdenv,
fetchurl,
fetchFromGitHub,
squashfsTools,
python3,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "widevine-helium";
version = "${finalAttrs.lacrosVersion}-${builtins.substring 0 7 finalAttrs.widevineInstaller.rev}";
lacrosVersion = "120.0.6098.0";
widevineInstaller = fetchFromGitHub {
owner = "AsahiLinux";
repo = "widevine-installer";
rev = "7a3928fe1342fb07d96f61c2b094e3287588958b";
sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y=";
};
src = fetchurl {
url = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-${finalAttrs.lacrosVersion}";
hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY=";
};
nativeBuildInputs = [
squashfsTools
python3
];
unpackPhase = ''
unsquashfs -q $src 'WidevineCdm/*'
python3 $widevineInstaller/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so libwidevinecdm.so
cp squashfs-root/WidevineCdm/manifest.json .
cp squashfs-root/WidevineCdm/LICENSE LICENSE.txt
'';
# Accoring to widevine-installer: "Hack because Chromium hardcodes a check for this right now..."
postInstall = ''
install -vD manifest.json "$out/share/helium/WidevineCdm/manifest.json"
install -vD LICENSE.txt "$out/share/helium/WidevineCdm/License.txt"
install -vD libwidevinecdm.so "$out/share/helium/WidevineCdm/_platform_specific/linux_arm64/libwidevinecdm.so"
mkdir -p "$out/share/helium/WidevineCdm/_platform_specific/linux_x64"
touch "$out/share/helium/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
'';
meta = import ./widevine-meta.nix lib;
})

View file

@ -0,0 +1,15 @@
lib: {
description = "Widevine CDM";
homepage = "https://www.widevine.com";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
jlamur
bearfm
];
platforms = lib.map (name: lib.removeSuffix ".nix" (lib.removePrefix "widevine-" name)) (
lib.filter (name: name != "meta.nix" && name != "package.nix") (
builtins.attrNames (builtins.readDir ./.)
)
);
}

15
packages/overlay.nix Normal file
View file

@ -0,0 +1,15 @@
final: prev: {
widevine-helium =
if prev.stdenv.hostPlatform.system == "aarch64-linux" then
prev.callPackage ./helium-browser/widevine-aarch64-linux.nix { }
else
null;
helium-browser = prev.callPackage (builtins.path { path = ./helium-browser/package.nix; }) { };
strawberry-master = prev.callPackage (builtins.path {
path = ./strawberry/package.nix;
}) { };
widevine-firefox = prev.callPackage (builtins.path { path = ./widevine-firefox/package.nix; }) { };
}

View file

@ -1,3 +0,0 @@
final: prev: {
strawberry-master = prev.callPackage (builtins.path { path = ./package.nix; }) { };
}

View file

@ -1,3 +0,0 @@
final: prev: {
widevine-firefox = prev.callPackage (builtins.path { path = ./package.nix; }) { };
}