openvr: use finalAttrs pattern

This commit is contained in:
Pol Dellaiera 2023-08-12 12:20:10 +02:00
parent 9d23f36514
commit f9f0f06230
No known key found for this signature in database
GPG key ID: D476DFE9C67467CA

View file

@ -1,22 +1,22 @@
{ lib { AppKit
, stdenv
, cmake , cmake
, libGL
, jsoncpp
, fetchFromGitHub , fetchFromGitHub
, fetchpatch2 , fetchpatch2
, Foundation , Foundation
, AppKit , jsoncpp
, lib
, libGL
, stdenv
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "openvr"; pname = "openvr";
version = "1.26.7"; version = "1.26.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ValveSoftware"; owner = "ValveSoftware";
repo = pname; repo = "openvr";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-verVIRyDdpF8lIjjjG8GllDJG7nhqByIfs/8O5TMOyc="; hash = "sha256-verVIRyDdpF8lIjjjG8GllDJG7nhqByIfs/8O5TMOyc=";
}; };
@ -25,13 +25,13 @@ stdenv.mkDerivation rec {
(fetchpatch2 { (fetchpatch2 {
name = "use-correct-CPP11-definition-for-vsprintf_s.patch"; name = "use-correct-CPP11-definition-for-vsprintf_s.patch";
url = "https://github.com/ValveSoftware/openvr/commit/0fa21ba17748efcca1816536e27bdca70141b074.patch"; url = "https://github.com/ValveSoftware/openvr/commit/0fa21ba17748efcca1816536e27bdca70141b074.patch";
sha256 = "sha256-0sPNDx5qKqCzN35FfArbgJ0cTztQp+SMLsXICxneLx4="; hash = "sha256-0sPNDx5qKqCzN35FfArbgJ0cTztQp+SMLsXICxneLx4=";
}) })
# https://github.com/ValveSoftware/openvr/pull/1716 # https://github.com/ValveSoftware/openvr/pull/1716
(fetchpatch2 { (fetchpatch2 {
name = "add-ability-to-build-with-system-installed-jsoncpp.patch"; name = "add-ability-to-build-with-system-installed-jsoncpp.patch";
url = "https://github.com/ValveSoftware/openvr/commit/54a58e479f4d63e62e9118637cd92a2013a4fb95.patch"; url = "https://github.com/ValveSoftware/openvr/commit/54a58e479f4d63e62e9118637cd92a2013a4fb95.patch";
sha256 = "sha256-aMojjbNjLvsGev0JaBx5sWuMv01sy2tG/S++I1NUi7U="; hash = "sha256-aMojjbNjLvsGev0JaBx5sWuMv01sy2tG/S++I1NUi7U=";
}) })
]; ];
@ -42,17 +42,26 @@ stdenv.mkDerivation rec {
mv source/src/json source/thirdparty/jsoncpp mv source/src/json source/thirdparty/jsoncpp
''; '';
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [
buildInputs = [ jsoncpp libGL ] ++ lib.optionals stdenv.isDarwin [ Foundation AppKit ]; cmake
];
buildInputs = [
jsoncpp
libGL
] ++ lib.optionals stdenv.isDarwin [
AppKit
Foundation
];
cmakeFlags = [ "-DUSE_SYSTEM_JSONCPP=ON" "-DBUILD_SHARED=1" ]; cmakeFlags = [ "-DUSE_SYSTEM_JSONCPP=ON" "-DBUILD_SHARED=1" ];
meta = with lib; { meta = {
broken = stdenv.isDarwin; broken = stdenv.isDarwin;
homepage = "https://github.com/ValveSoftware/openvr";
description = "An 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"; description = "An 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";
license = licenses.bsd3; homepage = "https://github.com/ValveSoftware/openvr";
maintainers = with maintainers; [ pedrohlc Scrumplex ]; license = lib.licenses.bsd3;
platforms = platforms.unix; maintainers = with lib.maintainers; [ pedrohlc Scrumplex ];
platforms = lib.platforms.unix;
}; };
} })