2023-08-12 10:20:10 +00:00
|
|
|
{ AppKit
|
2023-03-04 18:31:27 +00:00
|
|
|
, cmake
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch2
|
2023-05-09 15:23:01 +00:00
|
|
|
, Foundation
|
2023-08-12 10:20:10 +00:00
|
|
|
, jsoncpp
|
|
|
|
, lib
|
|
|
|
, libGL
|
|
|
|
, stdenv
|
2024-05-09 13:30:03 +00:00
|
|
|
, nix-update-script
|
2023-03-04 18:31:27 +00:00
|
|
|
}:
|
|
|
|
|
2023-08-12 10:20:10 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-03-04 18:31:27 +00:00
|
|
|
pname = "openvr";
|
2024-05-09 13:32:02 +00:00
|
|
|
version = "2.5.1";
|
2023-03-04 18:31:27 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ValveSoftware";
|
2023-08-12 10:20:10 +00:00
|
|
|
repo = "openvr";
|
|
|
|
rev = "v${finalAttrs.version}";
|
2024-05-09 13:32:02 +00:00
|
|
|
hash = "sha256-bIKjZ7DvJVmDK386WgXaAFQrS0E1TNEUMhfQp7FNnvk=";
|
2023-03-04 18:31:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# https://github.com/ValveSoftware/openvr/pull/594
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "use-correct-CPP11-definition-for-vsprintf_s.patch";
|
|
|
|
url = "https://github.com/ValveSoftware/openvr/commit/0fa21ba17748efcca1816536e27bdca70141b074.patch";
|
2023-08-12 10:20:10 +00:00
|
|
|
hash = "sha256-0sPNDx5qKqCzN35FfArbgJ0cTztQp+SMLsXICxneLx4=";
|
2023-03-04 18:31:27 +00:00
|
|
|
})
|
|
|
|
# https://github.com/ValveSoftware/openvr/pull/1716
|
|
|
|
(fetchpatch2 {
|
|
|
|
name = "add-ability-to-build-with-system-installed-jsoncpp.patch";
|
|
|
|
url = "https://github.com/ValveSoftware/openvr/commit/54a58e479f4d63e62e9118637cd92a2013a4fb95.patch";
|
2023-08-12 10:20:10 +00:00
|
|
|
hash = "sha256-aMojjbNjLvsGev0JaBx5sWuMv01sy2tG/S++I1NUi7U=";
|
2023-03-04 18:31:27 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
# Move in-tree jsoncpp out to complement the patch above
|
|
|
|
# fetchpatch2 is not able to handle these renames
|
|
|
|
mkdir source/thirdparty
|
|
|
|
mv source/src/json source/thirdparty/jsoncpp
|
|
|
|
'';
|
|
|
|
|
2023-08-12 10:20:10 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
jsoncpp
|
|
|
|
libGL
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
AppKit
|
|
|
|
Foundation
|
|
|
|
];
|
2023-03-04 18:31:27 +00:00
|
|
|
|
|
|
|
cmakeFlags = [ "-DUSE_SYSTEM_JSONCPP=ON" "-DBUILD_SHARED=1" ];
|
|
|
|
|
2024-05-09 13:30:03 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2023-08-12 10:20:10 +00:00
|
|
|
meta = {
|
2023-05-12 10:37:19 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2023-03-04 18:31:27 +00:00
|
|
|
description = "API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting";
|
2023-08-12 10:20:10 +00:00
|
|
|
homepage = "https://github.com/ValveSoftware/openvr";
|
|
|
|
license = lib.licenses.bsd3;
|
2023-11-28 14:30:26 +00:00
|
|
|
maintainers = with lib.maintainers; [ Scrumplex ];
|
2023-08-12 10:20:10 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2023-03-04 18:31:27 +00:00
|
|
|
};
|
2023-08-12 10:20:10 +00:00
|
|
|
})
|