Nixerus/pkgs/apps/games/alvr/default.nix

71 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2024-01-04 20:47:19 +01:00
{ stdenv, fetchzip, fetchurl, glib, lib, alsa-lib, gtk3, libunwind, x264, vulkan-loader, xorg, libva, libdrm, libvdpau, libbsd, libmd, xz }:
2023-10-23 22:46:25 +02:00
stdenv.mkDerivation rec {
pname = "alvr";
2024-01-04 20:47:19 +01:00
version = "v20.5.0";
2023-10-23 22:46:25 +02:00
src = fetchzip {
url = "https://github.com/alvr-org/ALVR/releases/download/${version}/alvr_streamer_linux.tar.gz";
name = "${pname}-${version}";
2024-01-04 20:47:19 +01:00
sha256 ="sha256-RkUVWk+6V+5MLwsvT7/d8JVps2MLnZfUMcWi8144E0I=";
2023-10-23 22:46:25 +02:00
};
sourceRoot = ".";
2023-10-24 21:24:54 +02:00
2023-10-23 22:46:25 +02:00
rpath = lib.makeLibraryPath [
stdenv.cc.cc.lib
alsa-lib
gtk3
2024-01-04 20:47:19 +01:00
glib
2023-10-23 22:46:25 +02:00
x264.lib
vulkan-loader
xorg.libX11
xorg.libXau
xorg.libXdmcp
xorg.libXext
xorg.libXfixes
libva
libdrm
libunwind
libbsd
libmd
xz
];
2023-10-24 21:24:54 +02:00
2023-10-23 22:46:25 +02:00
preferLocalBuild = true;
2023-10-24 21:24:54 +02:00
dontBuild = true;
2023-10-23 22:46:25 +02:00
installPhase = ''
2023-10-24 21:24:54 +02:00
runHook preInstall
2023-10-23 22:46:25 +02:00
2023-10-24 21:24:54 +02:00
mkdir -p $out/bin $out/opt/ALVR $out/share/vulkan/explicit_layer.d $out/share/applications/ $out/share/icons/hicolor/256x256/apps/
mv ${src.name}/* $out/opt/ALVR
2023-10-23 22:46:25 +02:00
2023-10-24 21:24:54 +02:00
cp ${./alvr.png} $out/share/icons/hicolor/256x256/apps/alvr.png
cp ${./alvr.desktop} $out/share/applications/alvr.desktop
2023-10-23 22:46:25 +02:00
2023-10-24 21:24:54 +02:00
ln -s $out/opt/ALVR/bin/alvr_dashboard $out/bin
ln -s $out/opt/ALVR/share/vulkan/explicit_layer.d/alvr_x86_64.json $out/share/vulkan/explicit_layer.d
runHook postInstall
2023-10-23 22:46:25 +02:00
'';
fixupPhase = ''
2023-10-24 21:24:54 +02:00
runHook preFixup
2023-10-23 22:46:25 +02:00
2023-10-24 21:24:54 +02:00
patchelf --set-rpath "${rpath}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/ALVR/bin/alvr_dashboard
patchelf --set-rpath "${rpath}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/ALVR/libexec/alvr/vrcompositor-wrapper
patchelf --set-rpath "${rpath}" $out/opt/ALVR/libexec/alvr/alvr_drm_lease_shim.so
patchelf --set-rpath "${rpath}" $out/opt/ALVR/lib64/libalvr_vulkan_layer.so
patchelf --set-rpath "${rpath}" $out/opt/ALVR/lib64/alvr/bin/linux64/driver_alvr_server.so
2023-10-23 22:46:25 +02:00
2023-10-24 21:24:54 +02:00
sed -i "s#../../../lib64/libalvr_vulkan_layer.so#$out/opt/ALVR/lib64/libalvr_vulkan_layer.so#" $out/opt/ALVR/share/vulkan/explicit_layer.d/alvr_x86_64.json
runHook postFixup
2023-10-23 22:46:25 +02:00
'';
meta = with lib; {
description = "ALVR - Stream VR games from your PC to your headset via Wi-Fi.";
homepage = "https://github.com/alvr-org/ALVR";
maintainers = with maintainers; [];
license = licenses.mit;
2023-10-23 23:11:24 +02:00
platforms = [ "x86_64-linux" ];
2023-10-23 22:46:25 +02:00
};
}