15 # See https://github.com/google-deepmind/mujoco/blob/3.0.0/cmake/MujocoDependencies.cmake#L17-L64
16 abseil-cpp = fetchFromGitHub {
19 rev = "2f9e432cce407ce0ae50676696666f33a77d42ac";
20 hash = "sha256-D4E11bICKr3Z5RRah7QkfXVsXtuUg32FMmKpiOGjZDM=";
22 benchmark = fetchFromGitHub {
25 rev = "e45585a4b8e75c28479fa4107182c28172799640";
26 hash = "sha256-pgHvmRpPd99ePUVRsi7WXLVSZngZ5q6r1vWW4mdGvxY=";
28 ccd = fetchFromGitHub {
31 rev = "7931e764a19ef6b21b443376c699bbc9c6d4fba8";
32 hash = "sha256-TIZkmqQXa0+bSWpqffIgaBela0/INNsX9LPM026x1Wk=";
34 eigen3 = fetchFromGitLab {
37 rev = "2a9055b50ed22101da7d77e999b90ed50956fe0b";
38 hash = "sha256-tx/XR7xJ7IMh5RMvL8wRo/g+dfD3xcjZkLPSY4D9HaY=";
40 googletest = fetchFromGitHub {
43 rev = "f8d7d77c06936315286eb55f8de22cd23c188571";
44 hash = "sha256-t0RchAHTJbuI5YW4uyBPykTvcjy90JW9AOPNjIhwh6U=";
46 lodepng = fetchFromGitHub {
49 rev = "b4ed2cd7ecf61d29076169b49199371456d4f90b";
50 hash = "sha256-5cCkdj/izP4e99BKfs/Mnwu9aatYXjlyxzzYiMD/y1M=";
52 qhull = fetchFromGitHub {
55 rev = "0c8fc90d2037588024d9964515c1e684f6007ecc";
56 hash = "sha256-Ptzxad3ewmKJbbcmrBT+os4b4SR976zlCG9F0nq0x94=";
58 tinyobjloader = fetchFromGitHub {
59 owner = "tinyobjloader";
60 repo = "tinyobjloader";
61 rev = "1421a10d6ed9742f5b2c1766d22faa6cfbc56248";
62 hash = "sha256-9z2Ne/WPCiXkQpT8Cun/pSGUwgClYH+kQ6Dx1JvW6w0=";
64 tinyxml2 = fetchFromGitHub {
65 owner = "leethomason";
67 rev = "9a89766acc42ddfa9e7133c7d81a5bda108a0ade";
68 hash = "sha256-YGAe4+Ttv/xeou+9FoJjmQCKgzupTYdDhd+gzvtz/88=";
70 marchingcubecpp = fetchFromGitHub {
72 repo = "MarchingCubeCpp";
73 rev = "5b79e5d6bded086a0abe276a4b5a69fc17ae9bf1";
74 hash = "sha256-L0DH1GJZ/3vatQAU/KZj/2xTKE6Fwcw9eQYzLdqX2N4=";
77 tmd = stdenv.mkDerivation rec {
78 name = "TriangleMeshDistance";
80 src = fetchFromGitHub {
81 owner = "InteractiveComputerGraphics";
83 rev = "e55a15c20551f36242fd6368df099a99de71d43a";
84 hash = "sha256-vj6TMMT8mp7ciLa5nzVAhMWPcAHXq+ZwHlWsRA3uCmg=";
88 mkdir -p $out/include/tmd
89 cp ${name}/include/tmd/${name}.h $out/include/tmd/
93 sdflib = stdenv.mkDerivation rec {
96 src = fetchFromGitHub {
99 rev = "1927bee6bb8225258a39c8cbf14e18a4d50409ae";
100 hash = "sha256-+SFUOdZ6pGZvnQa0mT+yfbTMHWe2CTOlroXcuVBHdOE=";
103 patches = [ ./sdflib-system-deps.patch ];
106 "-DSDFLIB_USE_ASSIMP=OFF"
107 "-DSDFLIB_USE_OPENMP=OFF"
108 "-DSDFLIB_USE_ENOKI=OFF"
109 "-DSDFLIB_USE_SYSTEM_GLM=ON"
110 "-DSDFLIB_USE_SYSTEM_SPDLOG=ON"
111 "-DSDFLIB_USE_SYSTEM_CEREAL=ON"
112 "-DSDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE=ON"
115 nativeBuildInputs = [ cmake ];
119 # Mainline. The otherwise pinned glm realease from 2018 does
120 # not build due to test failures and missing files.
130 in stdenv.mkDerivation rec {
134 # Bumping version? Make sure to look though the MuJoCo's commit
135 # history for bumped dependency pins!
136 src = fetchFromGitHub {
137 owner = "google-deepmind";
139 rev = "refs/tags/${version}";
140 hash = "sha256-VgD6ditMDpHki7l23Gjip2roA8Oi4MGpxl+4gSLTEFs=";
143 patches = [ ./mujoco-system-deps-dont-fetch.patch ];
145 nativeBuildInputs = [ cmake ];
158 "-DMUJOCO_USE_SYSTEM_sdflib=ON"
159 "-DMUJOCO_SIMULATE_USE_SYSTEM_GLFW=ON"
160 "-DMUJOCO_SAMPLES_USE_SYSTEM_GLFW=ON"
163 # Move things into place so that cmake doesn't try downloading dependencies.
166 ln -s ${pin.abseil-cpp} build/_deps/abseil-cpp-src
167 ln -s ${pin.benchmark} build/_deps/benchmark-src
168 ln -s ${pin.ccd} build/_deps/ccd-src
169 ln -s ${pin.eigen3} build/_deps/eigen3-src
170 ln -s ${pin.googletest} build/_deps/googletest-src
171 ln -s ${pin.lodepng} build/_deps/lodepng-src
172 ln -s ${pin.qhull} build/_deps/qhull-src
173 ln -s ${pin.tinyobjloader} build/_deps/tinyobjloader-src
174 ln -s ${pin.tinyxml2} build/_deps/tinyxml2-src
175 ln -s ${pin.marchingcubecpp} build/_deps/marchingcubecpp-src
178 passthru.pin = { inherit (pin) lodepng eigen3 abseil-cpp; };
181 description = "Multi-Joint dynamics with Contact. A general purpose physics simulator.";
182 homepage = "https://mujoco.org/";
183 changelog = "https://github.com/google-deepmind/mujoco/releases/tag/${version}";
184 license = licenses.asl20;
185 maintainers = with maintainers; [ samuela tmplt ];
186 broken = stdenv.isDarwin;