nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 writeText,
6 bluez,
7 cjson,
8 cmake,
9 config,
10 dbus,
11 doxygen,
12 eigen,
13 elfutils,
14 glslang,
15 gst_all_1,
16 hidapi,
17 libbsd,
18 libdrm,
19 libffi,
20 libGL,
21 libjpeg,
22 librealsense,
23 libsurvive,
24 libunwind,
25 libusb1,
26 libuv,
27 libuvc,
28 libv4l,
29 libXau,
30 libxcb,
31 libXdmcp,
32 libXext,
33 libXrandr,
34 nix-update-script,
35 onnxruntime,
36 opencv4,
37 openvr,
38 orc,
39 pcre2,
40 pkg-config,
41 python3,
42 SDL2,
43 shaderc,
44 tracy,
45 udev,
46 vulkan-headers,
47 vulkan-loader,
48 wayland,
49 wayland-protocols,
50 wayland-scanner,
51 zlib,
52 zstd,
53 nixosTests,
54 cudaPackages,
55 enableCuda ? config.cudaSupport,
56 # Set as 'false' to build monado without service support, i.e. allow VR
57 # applications linking against libopenxr_monado.so to use OpenXR standalone
58 # instead of via the monado-service program. For more information see:
59 # https://gitlab.freedesktop.org/monado/monado/-/blob/master/doc/targets.md#xrt_feature_service-disabled
60 serviceSupport ? true,
61 tracingSupport ? false,
62}:
63
64stdenv.mkDerivation (finalAttrs: {
65 pname = "monado";
66 version = "25.1.0";
67
68 src = fetchFromGitLab {
69 domain = "gitlab.freedesktop.org";
70 owner = "monado";
71 repo = "monado";
72 tag = "v${finalAttrs.version}";
73 hash = "sha256-hUSm76PV+FhvzhiYMUbGcNDQMK1TZCPYh1PNADJmdSU=";
74 };
75
76 nativeBuildInputs = [
77 cmake
78 doxygen
79 glslang
80 pkg-config
81 python3
82 ];
83
84 # known disabled drivers/features:
85 # - DRIVER_DEPTHAI - Needs depthai-core https://github.com/luxonis/depthai-core (See https://github.com/NixOS/nixpkgs/issues/292618)
86 # - DRIVER_ILLIXR - needs ILLIXR headers https://github.com/ILLIXR/ILLIXR (See https://github.com/NixOS/nixpkgs/issues/292661)
87 # - DRIVER_ULV2 - Needs proprietary Leapmotion SDK https://api.leapmotion.com/documentation/v2/unity/devguide/Leap_SDK_Overview.html (See https://github.com/NixOS/nixpkgs/issues/292624)
88 # - DRIVER_ULV5 - Needs proprietary Leapmotion SDK https://api.leapmotion.com/documentation/v2/unity/devguide/Leap_SDK_Overview.html (See https://github.com/NixOS/nixpkgs/issues/292624)
89
90 buildInputs = [
91 bluez
92 cjson
93 dbus
94 eigen
95 elfutils
96 gst_all_1.gst-plugins-base
97 gst_all_1.gstreamer
98 hidapi
99 libbsd
100 libdrm
101 libffi
102 libGL
103 libjpeg
104 librealsense
105 libsurvive
106 libunwind
107 libusb1
108 libuv
109 libuvc
110 libv4l
111 libXau
112 libxcb
113 libXdmcp
114 libXext
115 libXrandr
116 onnxruntime
117 opencv4
118 openvr
119 orc
120 pcre2
121 SDL2
122 shaderc
123 udev
124 vulkan-headers
125 vulkan-loader
126 wayland
127 wayland-protocols
128 wayland-scanner
129 zlib
130 zstd
131 ]
132 ++ lib.optionals tracingSupport [
133 tracy
134 ]
135 ++ lib.optionals enableCuda [
136 cudaPackages.cuda_nvcc
137 cudaPackages.cuda_cudart
138 ];
139
140 cmakeFlags = [
141 (lib.cmakeBool "XRT_FEATURE_SERVICE" serviceSupport)
142 (lib.cmakeBool "XRT_HAVE_TRACY" tracingSupport)
143 (lib.cmakeBool "XRT_FEATURE_TRACING" tracingSupport)
144 (lib.cmakeBool "XRT_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH" true)
145 ];
146
147 # Help openxr-loader find this runtime
148 setupHook = writeText "setup-hook" ''
149 export XDG_CONFIG_DIRS=@out@/etc/xdg''${XDG_CONFIG_DIRS:+:''${XDG_CONFIG_DIRS}}
150 '';
151
152 passthru = {
153 updateScript = nix-update-script { };
154 tests.basic-service = nixosTests.monado;
155 };
156
157 meta = {
158 description = "Open source XR runtime";
159 homepage = "https://monado.freedesktop.org/";
160 license = lib.licenses.boost;
161 maintainers = with lib.maintainers; [ Scrumplex ];
162 platforms = lib.platforms.linux;
163 mainProgram = "monado-cli";
164 };
165})