1 { lib, stdenv, fetchFromGitHub, cmake, python3, libX11, libXxf86vm, libXrandr, vulkan-headers, libGL, vulkan-loader, wayland, pkg-config }:
3 stdenv.mkDerivation rec {
4 pname = "openxr-loader";
7 src = fetchFromGitHub {
8 owner = "KhronosGroup";
9 repo = "OpenXR-SDK-Source";
10 rev = "release-${version}";
11 sha256 = "sha256-qK8l/v6nLuMAitz7DfVDjJyVjEmkeD2jgJkG5qOMCcQ=";
14 nativeBuildInputs = [ cmake python3 pkg-config ];
15 buildInputs = [ libX11 libXxf86vm libXrandr vulkan-headers libGL vulkan-loader wayland ];
17 cmakeFlags = [ "-DBUILD_TESTS=ON" ];
19 outputs = [ "out" "dev" "layers" ];
21 # https://github.com/KhronosGroup/OpenXR-SDK-Source/issues/305
23 substituteInPlace src/loader/openxr.pc.in \
24 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
28 mkdir -p "$layers/share"
29 mv "$out/share/openxr" "$layers/share"
30 # Use absolute paths in manifests so no LD_LIBRARY_PATH shenanigans are necessary
31 for file in "$layers/share/openxr/1/api_layers/explicit.d/"*; do
32 substituteInPlace "$file" --replace '"library_path": "lib' "\"library_path\": \"$layers/lib/lib"
34 mkdir -p "$layers/lib"
35 mv "$out/lib/libXrApiLayer"* "$layers/lib"
39 description = "Khronos OpenXR loader";
40 homepage = "https://www.khronos.org/openxr";
41 platforms = platforms.linux;
42 license = licenses.asl20;
43 maintainers = [ maintainers.ralith ];