alvr: use ffmpeg_6 with patches from alvr source (#508407)

This commit is contained in:
Silvan Mosberger 2026-06-09 09:15:32 +00:00 committed by GitHub
commit e3e87d1158
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 13 deletions

View file

@ -0,0 +1,38 @@
{
lib,
ffmpeg_6,
alvr,
}:
(ffmpeg_6.override {
version = "6.0";
hash = "sha256-RVbgsafIbeUUNXmUbDQ03ZN42oaUo0njqROo7KOQgv0=";
withHardcodedTables = false;
withHtmlDoc = false;
withManPages = false;
withPodDoc = false;
withTxtDoc = false;
withDocumentation = false;
}).overrideAttrs
(old: {
# apply our own ffmpeg patches, but skip texinfo-7.1.patch as it does not apply to 6.0.
# apply upstream patches for ALVR as well.
patches =
(lib.filter (p: !(lib.hasSuffix "texinfo-7.1.patch" (baseNameOf (toString p)))) old.patches)
++ [
(alvr.src + "/alvr/xtask/patches/0001-Add-AV_VAAPI_DRIVER_QUIRK_HEVC_ENCODER_ALIGN_64_16-f.patch")
(alvr.src + "/alvr/xtask/patches/0001-av1-encode-backport.patch")
(alvr.src + "/alvr/xtask/patches/0001-clip-constants-used-with-shift-instr.patch")
(alvr.src + "/alvr/xtask/patches/0001-guid-conftest.patch")
(alvr.src + "/alvr/xtask/patches/0001-lavu-hwcontext_vulkan-Fix-importing-RGBx-frames-to-C.patch")
(alvr.src + "/alvr/xtask/patches/0001-update-rc-modes.patch")
(alvr.src + "/alvr/xtask/patches/0001-vaapi_encode-Add-filler_data-option.patch")
(alvr.src + "/alvr/xtask/patches/0001-vaapi_encode-Allow-to-dynamically-change-bitrate-and.patch")
(alvr.src + "/alvr/xtask/patches/0001-vaapi_encode-Enable-global-header.patch")
(alvr.src + "/alvr/xtask/patches/0001-vaapi_encode_h265-Set-vui_parameters_present_flag.patch")
];
doCheck = false;
})

View file

@ -5,6 +5,7 @@
fetchpatch,
replaceVars,
nix-update-script,
callPackage,
pkg-config,
autoAddDriverRunpath,
alsa-lib,
@ -12,7 +13,7 @@
brotli,
bzip2,
celt,
ffmpeg_7,
ffmpeg-alvr ? callPackage ./ffmpeg.nix { },
gmp,
jack2,
lame,
@ -43,6 +44,7 @@
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "alvr";
version = "20.14.1";
src = fetchFromGitHub {
@ -57,7 +59,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
patches = [
(replaceVars ./fix-finding-libs.patch {
ffmpeg = lib.getDev ffmpeg_7;
ffmpeg = lib.getDev ffmpeg-alvr;
x264 = lib.getDev x264;
})
(fetchpatch {
@ -66,15 +68,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
})
];
postPatch = ''
substituteInPlace alvr/server_openvr/cpp/platform/linux/EncodePipelineVAAPI.cpp \
--replace-fail 'FF_PROFILE_H264_MAIN' 'AV_PROFILE_H264_MAIN' \
--replace-fail 'FF_PROFILE_H264_BASELINE' 'AV_PROFILE_H264_BASELINE' \
--replace-fail 'FF_PROFILE_H264_HIGH' 'AV_PROFILE_H264_HIGH' \
--replace-fail 'FF_PROFILE_HEVC_MAIN' 'AV_PROFILE_HEVC_MAIN' \
--replace-fail 'FF_PROFILE_AV1_MAIN' 'AV_PROFILE_AV1_MAIN'
'';
env = {
NIX_CFLAGS_COMPILE = toString [
"-lbrotlicommon"
@ -112,7 +105,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
brotli
bzip2
celt
ffmpeg_7
ffmpeg-alvr
gmp
jack2
lame
@ -158,7 +151,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
ln -s $out/lib $out/lib64
'';
passthru.updateScript = nix-update-script { };
passthru = {
inherit ffmpeg-alvr;
updateScript = nix-update-script { };
};
meta = {
description = "Stream VR games from your PC to your headset via Wi-Fi";
@ -169,6 +165,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
maintainers = with lib.maintainers; [
luNeder
jopejoe1
eyjhb
];
platforms = lib.platforms.linux;
};