nixfiles/overlay/widevine-aarch64/default.nix

53 lines
1.7 KiB
Nix
Raw Permalink Normal View History

{
stdenv,
fetchurl,
squashfsTools,
python3,
nspr,
2024-09-04 13:49:32 +01:00
# Depends on kernel used, in kb
pageSize ? 4,
2024-09-04 15:00:56 +01:00
}: let
lacrosVersion = "128.0.6613.119";
in
stdenv.mkDerivation {
pname = "widevine-aarch64-${toString pageSize}k";
2024-09-04 20:25:07 +01:00
version = "widevineVersion";
2024-09-04 15:00:56 +01:00
srcs = fetchurl {
url = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-${lacrosVersion}";
hash = "sha256-Q3g2npzSh9imzn36AR8EDWB5LS9MlhRBEqalNCLDxHI=";
};
2024-09-04 15:00:56 +01:00
unpackPhase = ":";
sourceRoot = ".";
2024-09-04 15:00:56 +01:00
buildPhase = ''
unsquashfs -q $srcs 'WidevineCdm/*'
env TARGET_PAGE_SIZE=${toString (pageSize * 1024)} python3 ${./widevine_fixup.py} squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so libwidevinecdm.so
'';
2024-09-04 15:00:56 +01:00
# TODO: systemwide install
installPhase = ''
install -d -m 0755 "$out"
install -p -m 0755 -t "$out" libwidevinecdm.so
install -p -m 0644 -t "$out" squashfs-root/WidevineCdm/manifest.json
install -p -m 0644 -t "$out" squashfs-root/WidevineCdm/LICENSE
2024-09-04 15:00:56 +01:00
mkdir -p "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_arm64"
mkdir -p "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_x64"
# Hack because Chromium hardcodes a check for this right now...
touch "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
ln -sf ../../../../manifest.json "$out/share/google/chrome/WidevineCdm"
ln -sf ../../../../../../libwidevinecdm.so "$out/share/google/chrome/WidevineCdm/_platform_specific/linux_arm64/"
'';
2024-09-04 15:00:56 +01:00
nativeBuildInputs = [
squashfsTools
python3
];
buildInputs = [
nspr
];
2024-09-04 15:00:56 +01:00
}