nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 170 lines 3.5 kB view raw
1{ 2 lib, 3 rustPlatform, 4 fetchFromGitHub, 5 replaceVars, 6 nix-update-script, 7 pkg-config, 8 autoAddDriverRunpath, 9 alsa-lib, 10 android-tools, 11 brotli, 12 bzip2, 13 celt, 14 ffmpeg, 15 gmp, 16 jack2, 17 lame, 18 libX11, 19 libXi, 20 libXrandr, 21 libXcursor, 22 libdrm, 23 libglvnd, 24 libogg, 25 libpng, 26 libtheora, 27 libunwind, 28 libva, 29 libvdpau, 30 libxkbcommon, 31 openapv, 32 openssl, 33 openvr, 34 pipewire, 35 rust-cbindgen, 36 soxr, 37 vulkan-headers, 38 vulkan-loader, 39 wayland, 40 x264, 41 xvidcore, 42}: 43rustPlatform.buildRustPackage rec { 44 pname = "alvr"; 45 version = "20.14.1"; 46 47 src = fetchFromGitHub { 48 owner = "alvr-org"; 49 repo = "ALVR"; 50 tag = "v${version}"; 51 fetchSubmodules = true; # TODO devendor openvr 52 hash = "sha256-9fckUhUPAbcmbqOdUO8RlwuK8/nf1fc7XQBrAu5YaR4="; 53 }; 54 55 cargoHash = "sha256-OTCMWrlwnfpUhm6ssOE133e/3DaQFnOU+NunN2c1N+g="; 56 57 patches = [ 58 (replaceVars ./fix-finding-libs.patch { 59 ffmpeg = lib.getDev ffmpeg; 60 x264 = lib.getDev x264; 61 }) 62 ]; 63 64 postPatch = '' 65 substituteInPlace alvr/server_openvr/cpp/platform/linux/EncodePipelineVAAPI.cpp \ 66 --replace-fail 'FF_PROFILE_H264_MAIN' 'AV_PROFILE_H264_MAIN' \ 67 --replace-fail 'FF_PROFILE_H264_BASELINE' 'AV_PROFILE_H264_BASELINE' \ 68 --replace-fail 'FF_PROFILE_H264_HIGH' 'AV_PROFILE_H264_HIGH' \ 69 --replace-fail 'FF_PROFILE_HEVC_MAIN' 'AV_PROFILE_HEVC_MAIN' \ 70 --replace-fail 'FF_PROFILE_AV1_MAIN' 'AV_PROFILE_AV1_MAIN' 71 ''; 72 73 env = { 74 NIX_CFLAGS_COMPILE = toString [ 75 "-lbrotlicommon" 76 "-lbrotlidec" 77 "-lcrypto" 78 "-lpng" 79 "-lssl" 80 ]; 81 RUSTFLAGS = toString ( 82 map (a: "-C link-arg=${a}") [ 83 "-Wl,--push-state,--no-as-needed" 84 "-lEGL" 85 "-lwayland-client" 86 "-lxkbcommon" 87 "-Wl,--pop-state" 88 ] 89 ); 90 }; 91 92 cargoBuildFlags = [ 93 "--exclude=alvr_xtask" 94 "--workspace" 95 ]; 96 97 nativeBuildInputs = [ 98 rust-cbindgen 99 pkg-config 100 rustPlatform.bindgenHook 101 autoAddDriverRunpath 102 ]; 103 104 buildInputs = [ 105 alsa-lib 106 android-tools 107 brotli 108 bzip2 109 celt 110 ffmpeg 111 gmp 112 jack2 113 lame 114 libX11 115 libXcursor 116 libXi 117 libXrandr 118 libdrm 119 libglvnd 120 libogg 121 libpng 122 libtheora 123 libunwind 124 libva 125 libvdpau 126 libxkbcommon 127 openapv 128 openssl 129 openvr 130 pipewire 131 soxr 132 vulkan-headers 133 vulkan-loader 134 wayland 135 x264 136 xvidcore 137 ]; 138 139 postBuild = '' 140 # Build SteamVR driver ("streamer") 141 cargo xtask build-streamer --release 142 ''; 143 144 postInstall = '' 145 install -Dm755 ${src}/alvr/xtask/resources/alvr.desktop $out/share/applications/alvr.desktop 146 install -Dm644 ${src}/resources/ALVR-Icon.svg $out/share/icons/hicolor/scalable/apps/alvr.svg 147 148 # Install SteamVR driver 149 mkdir -p $out/{libexec,lib/alvr,share} 150 cp -r ./build/alvr_streamer_linux/lib64/. $out/lib 151 cp -r ./build/alvr_streamer_linux/libexec/. $out/libexec 152 cp -r ./build/alvr_streamer_linux/share/. $out/share 153 ln -s $out/lib $out/lib64 154 ''; 155 156 passthru.updateScript = nix-update-script { }; 157 158 meta = { 159 description = "Stream VR games from your PC to your headset via Wi-Fi"; 160 homepage = "https://github.com/alvr-org/ALVR/"; 161 changelog = "https://github.com/alvr-org/ALVR/releases/tag/v${version}"; 162 license = lib.licenses.mit; 163 mainProgram = "alvr_dashboard"; 164 maintainers = with lib.maintainers; [ 165 luNeder 166 jopejoe1 167 ]; 168 platforms = lib.platforms.linux; 169 }; 170}