12 let examplesOnOff = if withExamples then "ON" else "OFF"; in
14 stdenv.mkDerivation rec {
18 src = fetchFromGitHub {
22 sha256 = "1hkpdl4zgycag5k8njvqpx01apxmm8m8pvhlsxgxpqiqy9a38ccg";
25 nativeBuildInputs = [ cmake pkg-config ];
29 ] ++ lib.optionals withExamples [
36 "-DBUILD_BOTH_STATIC_SHARED_LIBS=ON"
37 "-DOPENHMD_EXAMPLE_SIMPLE=${examplesOnOff}"
38 "-DOPENHMD_EXAMPLE_SDL=${examplesOnOff}"
39 "-DOpenGL_GL_PREFERENCE=GLVND"
41 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
42 "-DCMAKE_SKIP_BUILD_RPATH=ON"
45 postInstall = lib.optionalString withExamples ''
47 install -D examples/simple/simple $out/bin/openhmd-example-simple
48 install -D examples/opengl/openglexample $out/bin/openhmd-example-opengl
52 homepage = "http://www.openhmd.net"; # https does not work
53 description = "Library API and drivers immersive technology";
55 OpenHMD is a very simple FLOSS C library and a set of drivers
56 for interfacing with Virtual Reality (VR) Headsets aka
57 Head-mounted Displays (HMDs), controllers and trackers like
58 Oculus Rift, HTC Vive, Windows Mixed Reality, and etc.
60 license = licenses.boost;
61 maintainers = with maintainers; [ oxij ];
62 platforms = platforms.unix;