diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 6039d47053640..7d3d8e20b1a73 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -26717,6 +26717,11 @@ githubId = 555003; name = "Taylor Everding"; }; + taylorhoward92 = { + github = "taylorhoward92"; + githubId = 23712266; + name = "Taylor Howard"; + }; tazjin = { email = "mail@tazj.in"; github = "tazjin"; diff --git a/pkgs/by-name/gz/gz-cmake/package.nix b/pkgs/by-name/gz/gz-cmake/package.nix index 34d9fefd98064..8c765ad219d04 100644 --- a/pkgs/by-name/gz/gz-cmake/package.nix +++ b/pkgs/by-name/gz/gz-cmake/package.nix @@ -11,7 +11,7 @@ nix-update-script, }: let - version = "5.0.0"; + version = "5.1.1"; versionPrefix = "gz-cmake${lib.versions.major version}"; in stdenv.mkDerivation (finalAttrs: { @@ -22,7 +22,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "gazebosim"; repo = "gz-cmake"; tag = "${versionPrefix}_${finalAttrs.version}"; - hash = "sha256-XF7oglj9Xr6F8a+6uowrY5a040yl4FZlFfW/Y0BJwOs="; + hash = "sha256-bp3qaLuE/0sf6u4ZVOGsuJVkuEm2IS0zB0vHMVE0g/g="; }; postPatch = '' @@ -52,21 +52,19 @@ stdenv.mkDerivation (finalAttrs: { doCheck = true; - passthru = { - # bulk updater selects wrong tag - skipBulkUpdates = true; - updateScript = nix-update-script { - extraArgs = [ "--version-regex=gz-cmake(.*)" ]; - }; + passthru.updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; }; meta = { description = "CMake modules to build Gazebo projects"; homepage = "https://github.com/gazebosim/gz-cmake"; - changelog = "https://github.com/gazebosim/gz-cmake/releases/tag/${finalAttrs.src.tag}"; + changelog = "https://github.com/gazebosim/gz-cmake/blob/${finalAttrs.src.tag}/Changelog.md"; license = lib.licenses.asl20; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [ guelakais ]; - badPlatforms = lib.platforms.darwin; # hard replicable building error + platforms = lib.platforms.linux ++ lib.platforms.darwin; + maintainers = with lib.maintainers; [ + guelakais + taylorhoward92 + ]; }; }) diff --git a/pkgs/by-name/gz/gz-common/package.nix b/pkgs/by-name/gz/gz-common/package.nix new file mode 100644 index 0000000000000..a2145e08d5df1 --- /dev/null +++ b/pkgs/by-name/gz/gz-common/package.nix @@ -0,0 +1,122 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + pkg-config, + gz-cmake, + gz-math, + gz-utils, + tinyxml-2, + spdlog, + libuuid, + assimp, + gdal, + ffmpeg, + zlib, + ctestCheckHook, + python3, + gtest, + nix-update-script, + testers, +}: +let + version = "7.1.1"; + versionPrefix = "gz-common${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-common"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-common"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-0+C2gvX7vF/8DbRfX0rftbrYydO6zHYXAhWDe3YXWcs="; + }; + + patches = [ + # Replace FreeImage with STB image headers (vendored). + # TODO: Remove after update to > 7.1.1 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-common/commit/a2d36c050b8e93e23b3d8d5ec1abb7b87c61cfdc.patch?full_index=1"; + hash = "sha256-Zk6kFfWWSwNon/HcLDMmmO1XZrMUoPbc6bk0zAXXN9Y="; + }) + + # Replace hardcoded /home with /tmp in SystemPaths_TEST.cc FindFile test. + # TODO: Remove after update to > 7.1.1 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-common/commit/2d63d3f5b3f4b29418955a7c266a199f803e6d5c.patch?full_index=1"; + hash = "sha256-Gws0KVhfGd61uPNC1gJXlCaY81tVZeU6PlqcJA40LeA="; + }) + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + gz-cmake + # direct DT_NEEDED of libgz-common-graphics.so (linked via assimp/gdal) + zlib + ]; + + propagatedBuildInputs = [ + assimp + ffmpeg + gdal + gz-math + gz-utils + spdlog + tinyxml-2 + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + libuuid + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + disabledTests = [ + # Timing-sensitive under Nix build load + "INTEGRATION_encoder_timing" + "UNIT_WorkerPool_TEST" + # Signal handling is unreliable in the Nix sandbox + "UNIT_SignalHandler_TEST" + ]; + + doCheck = true; + + preCheck = '' + # Some test cases use $HOME + export HOME=$(mktemp -d) + ''; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Common libraries for the Gazebo projects (audio, graphics, geospatial, AV)"; + homepage = "https://github.com/gazebosim/gz-common"; + changelog = "https://github.com/gazebosim/gz-common/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-common" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-fuel-tools/package.nix b/pkgs/by-name/gz/gz-fuel-tools/package.nix new file mode 100644 index 0000000000000..455226b790438 --- /dev/null +++ b/pkgs/by-name/gz/gz-fuel-tools/package.nix @@ -0,0 +1,111 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + ctestCheckHook, + pkg-config, + gz-cmake, + gz-common, + gz-msgs, + gz-tools, + curl, + jsoncpp, + libyaml, + libzip, + tinyxml-2, + python3, + gtest, + nix-update-script, + testers, +}: +let + version = "11.0.0"; + versionPrefix = "gz-fuel-tools${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-fuel-tools"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-fuel-tools"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-IFnaXBURpN5xTCxFjlcZk9n0sCsUnPBr3NUZrf7Xde0="; + }; + + patches = [ + # Upstream bug: the test YAML config points library_path at src/cmd/cmdfuel11 + # instead of the generated Ruby script in test/lib/ruby/gz/cmdfuel11. + # Also switch to configure_file + file(GENERATE) so $ is resolved. + # https://github.com/gazebosim/gz-fuel-tools/pull/501 + ./patches/pr-501.patch + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + libzip + curl + gz-common + gz-msgs + gz-tools + jsoncpp + libyaml + tinyxml-2 + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + disabledTests = [ + # Requires network access (unavailable in Nix sandbox). + "UNIT_FuelClient_TEST" + "UNIT_Interface_TEST" + "UNIT_gz_TEST" + "UNIT_gz_src_TEST" + ]; + + preCheck = '' + # Some test cases use $HOME. + export HOME=$(mktemp -d) + + # Point tests at the generated config files in the build tree. + export GZ_CONFIG_PATH=$PWD/test/conf + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Client library and command line tools for interacting with Gazebo Fuel servers"; + homepage = "https://github.com/gazebosim/gz-fuel-tools"; + changelog = "https://github.com/gazebosim/gz-fuel-tools/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-fuel-tools" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-fuel-tools/patches/pr-501.patch b/pkgs/by-name/gz/gz-fuel-tools/patches/pr-501.patch new file mode 100644 index 0000000000000..d879d9317a9e6 --- /dev/null +++ b/pkgs/by-name/gz/gz-fuel-tools/patches/pr-501.patch @@ -0,0 +1,22 @@ +diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt +index 2cffca0e..972fba99 100644 +--- a/conf/CMakeLists.txt ++++ b/conf/CMakeLists.txt +@@ -1,11 +1,15 @@ +-set(gz_library_path "${CMAKE_BINARY_DIR}/src/cmd/cmdfuel${PROJECT_VERSION_MAJOR}") ++set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/$/ruby/gz/cmdfuel${PROJECT_VERSION_MAJOR}") + + # Generate a configuration file for internal testing. + # Note that the major version of the library is included in the name. + # Ex: fuel0.yaml + configure_file( + "fuel.yaml.in" +- "${CMAKE_BINARY_DIR}/test/conf/fuel${PROJECT_VERSION_MAJOR}.yaml" @ONLY) ++ "${CMAKE_CURRENT_BINARY_DIR}/fuel${PROJECT_VERSION_MAJOR}.yaml.configured" @ONLY) ++ ++file(GENERATE ++ OUTPUT "${CMAKE_BINARY_DIR}/test/conf/$/fuel${PROJECT_VERSION_MAJOR}.yaml" ++ INPUT "${CMAKE_CURRENT_BINARY_DIR}/fuel${PROJECT_VERSION_MAJOR}.yaml.configured") + + set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmdfuel${PROJECT_VERSION_MAJOR}") + diff --git a/pkgs/by-name/gz/gz-gui/package.nix b/pkgs/by-name/gz/gz-gui/package.nix new file mode 100644 index 0000000000000..b17153e03a85f --- /dev/null +++ b/pkgs/by-name/gz/gz-gui/package.nix @@ -0,0 +1,140 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + pkg-config, + gz-cmake, + gz-common, + gz-msgs, + gz-plugin, + gz-rendering, + gz-transport, + protobuf, + tinyxml-2, + qt6, + libsodium, + ctestCheckHook, + python3, + gtest, + testers, + nix-update-script, +}: +let + version = "10.0.0"; + versionPrefix = "gz-gui${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-gui"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-gui"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-s34FtTFWV6+qakYz6atZfl20y7u8KQAU58a63FghhKc="; + }; + + patches = [ + # Fix test race: TopicEcho_TEST and Publisher_TEST both used the /echo topic; + # use a unique topic name in TopicEcho_TEST to avoid cross-contamination + # under parallel ctest execution. + # TODO: Remove after update to > 10.0.0 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-gui/commit/3d785e8b9f1b5ebb02198f3a645d5de77e556759.patch?full_index=1"; + hash = "sha256-b40w5d8uMgCwIUf1zfMWGndGUKIBljjf0lIwO4nJUy4="; + }) + ]; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + protobuf + ]; + + # Nix sets CMAKE_INSTALL_LIBDIR to an absolute store path, which produces + # broken doubled paths in getPluginInstallDir(). Force it to be relative. + cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + gz-common + gz-msgs + gz-plugin + gz-rendering + gz-transport + protobuf + tinyxml-2 + qt6.qt5compat + qt6.qtbase + qt6.qtdeclarative + qt6.qtquick3d + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + disabledTests = [ + # Tries to build examples against the installed package, which is not + # available during the check phase. + "INTEGRATION_ExamplesBuild_TEST" + + # Requires GPU/display server (SEGFAULTs without rendering context) which + # is not available in the Nix sandbox. + "INTEGRATION_camera_tracking" + "INTEGRATION_marker_manager" + "INTEGRATION_minimal_scene" + "INTEGRATION_transport_scene_manager" + ]; + + preCheck = '' + # Headless Qt workaround for sandboxed builds. + export QT_QPA_PLATFORM=offscreen + + # Some test cases use $HOME + export HOME=$(mktemp -d) + + # Test binaries are not wrapped, so QML modules must be found explicitly + export QML_IMPORT_PATH="${qt6.qtdeclarative}/lib/qt-6/qml:${qt6.qt5compat}/lib/qt-6/qml:${qt6.qtquick3d}/lib/qt-6/qml''${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}" + '' + + lib.optionalString stdenv.hostPlatform.isLinux '' + # Test binaries lack RPATH for transitive dependencies + export LD_LIBRARY_PATH=${lib.makeLibraryPath [ libsodium ]}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + + # Plugins are not installed yet during check; point tests at the build tree + export GZ_GUI_PLUGIN_PATH="$PWD/lib''${GZ_GUI_PLUGIN_PATH:+:$GZ_GUI_PLUGIN_PATH}" + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "QML-based application framework for Gazebo robot simulation tools"; + homepage = "https://github.com/gazebosim/gz-gui"; + changelog = "https://github.com/gazebosim/gz-gui/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-gui" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-math/package.nix b/pkgs/by-name/gz/gz-math/package.nix new file mode 100644 index 0000000000000..8715e4d97a235 --- /dev/null +++ b/pkgs/by-name/gz/gz-math/package.nix @@ -0,0 +1,85 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + gz-cmake, + gz-utils, + eigen, + python3Packages, + swig, + ruby, + ctestCheckHook, + gtest, + testers, + nix-update-script, +}: +let + version = "9.1.0"; + versionPrefix = "gz-math${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-math"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-math"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-Kc9g5D52+NVygYLpMf+4GFPPn2sTEfXBOC14iw39NlA="; + }; + + nativeBuildInputs = [ + cmake + python3Packages.python + python3Packages.pybind11 + swig + ruby + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + eigen + gz-utils + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3Packages.python + ]; + + checkInputs = [ gtest ]; + + disabledTests = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + # Non-deterministic random tests fail on aarch64-darwin + "GaussMarkovProcess_TEST.rb" + "Rand_TEST.rb" + ]; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "General purpose math library for robot applications"; + homepage = "https://github.com/gazebosim/gz-math"; + changelog = "https://github.com/gazebosim/gz-math/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-math" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-msgs/package.nix b/pkgs/by-name/gz/gz-msgs/package.nix new file mode 100644 index 0000000000000..681b7941d1f8f --- /dev/null +++ b/pkgs/by-name/gz/gz-msgs/package.nix @@ -0,0 +1,104 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + gz-cmake, + gz-math, + gz-tools, + gz-utils, + protobuf, + tinyxml-2, + python3Packages, + ctestCheckHook, + gtest, + nix-update-script, + testers, +}: +let + version = "12.0.1"; + versionPrefix = "gz-msgs${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-msgs"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-msgs"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-XMzokmj6DXiDtbE/FNK+j4qllm7IsmE8vZsQSXEQNIs="; + }; + + nativeBuildInputs = [ + cmake + python3Packages.python + ]; + + propagatedNativeBuildInputs = [ + protobuf + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + gz-math + gz-tools + gz-utils + protobuf + tinyxml-2 + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3Packages.python + python3Packages.protobuf + ]; + + checkInputs = [ gtest ]; + + patches = [ + # Use ENVIRONMENT_MODIFICATION (prepend) instead of ENVIRONMENT (overwrite) + # for Python test PYTHONPATH — fixes broken CMAKE_INSTALL_PREFIX paths + # and allows the shell env to provide dependency paths. + # https://github.com/gazebosim/gz-msgs/pull/588 (backport of #584) + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-msgs/commit/aac2461dfa3210b5939a1a71da8918b6033311cc.patch?full_index=1"; + hash = "sha256-lELP0hYB8DBcBcjRIfr6TgVl0lpQxilQQmay3Apy+oA="; + }) + ]; + + preCheck = '' + # Python tests need generated protobuf bindings from the build tree and + # google.protobuf from the Nix store, neither of which is on PYTHONPATH + # by default in the sandbox. + export PYTHONPATH=$PWD/gz_msgs_gen/python:${python3Packages.protobuf}/${python3Packages.python.sitePackages}:$PYTHONPATH + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Protobuf messages for the Gazebo robot simulation libraries"; + homepage = "https://github.com/gazebosim/gz-msgs"; + changelog = "https://github.com/gazebosim/gz-msgs/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-msgs" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-physics/package.nix b/pkgs/by-name/gz/gz-physics/package.nix new file mode 100644 index 0000000000000..4aa6d14eb70c5 --- /dev/null +++ b/pkgs/by-name/gz/gz-physics/package.nix @@ -0,0 +1,130 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + gz-cmake, + gz-common, + gz-math, + gz-plugin, + gz-utils, + sdformat, + eigen, + dartsim, + bullet, + spdlog, + zlib, + ctestCheckHook, + python3, + gtest, + nix-update-script, + testers, +}: +let + version = "9.3.0"; + versionPrefix = "gz-physics${lib.versions.major version}"; + ldLibraryPathEnv = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-physics"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-physics"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-HUydNVfOX/nWi0a29CcFlM2dCt9hqfsafJR61WkBPIw="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + # Nix sets CMAKE_INSTALL_LIBDIR to an absolute store path, which produces + # broken doubled paths in getEngineInstallDir(). Force it to be relative. + cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + bullet + dartsim + gz-common + gz-math + gz-plugin + gz-utils + sdformat + eigen + spdlog + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + postPatch = '' + # Fix shebang in testrunner.bash (uses #!/bin/bash which doesn't exist in sandbox). + patchShebangs test/static_assert/testrunner.bash + ''; + + disabledTests = [ + # Dartsim/bullet tolerance-based assertions too tight for sandbox builds. + "COMMON_TEST_detachable_joint_dartsim" + "COMMON_TEST_joint_features_dartsim" + "UNIT_SDFFeatures_TEST" + # Performance benchmark — timing-sensitive under Nix build load + "PERFORMANCE_ExpectData" + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + # Dartsim mesh-plane collision test crashes with SIGTRAP on aarch64-darwin. + # Upstream CI passes because Bazel statically links everything into one binary. + # In Nix, the dartsim plugin is a shared library loaded via dlopen(RTLD_LOCAL), + # which causes RTTI fragmentation on macOS. + "COMMON_TEST_collisions_dartsim" + ]; + + preCheck = '' + # Some test cases use $HOME + export HOME=$(mktemp -d) + + # Plugin shared libraries in the build tree need dartsim/bullet libs on the linker path. + export ${ldLibraryPathEnv}=${ + lib.makeLibraryPath [ + dartsim + bullet + zlib + ] + }''${${ldLibraryPathEnv}:+:$${ldLibraryPathEnv}} + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Abstract physics interface designed for robot simulation"; + homepage = "https://github.com/gazebosim/gz-physics"; + changelog = "https://github.com/gazebosim/gz-physics/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-physics" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-plugin/package.nix b/pkgs/by-name/gz/gz-plugin/package.nix new file mode 100644 index 0000000000000..bace25f5f8676 --- /dev/null +++ b/pkgs/by-name/gz/gz-plugin/package.nix @@ -0,0 +1,76 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + gz-cmake, + gz-utils, + ctestCheckHook, + python3, + gtest, + nix-update-script, + testers, +}: +let + version = "4.0.0"; + versionPrefix = "gz-plugin${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-plugin"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-plugin"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-cHpRXLKm3BHJJibL5VdLMHyRYAD3gLP7ageyFY13tZE="; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + gz-utils + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + postPatch = '' + # Fix shebang in testrunner.bash (uses #!/bin/bash which doesn't exist in sandbox) + patchShebangs test/static_assertions/testrunner.bash + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Cross-platform C++ library for dynamically loading plugins"; + homepage = "https://github.com/gazebosim/gz-plugin"; + changelog = "https://github.com/gazebosim/gz-plugin/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-plugin" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-rendering/package.nix b/pkgs/by-name/gz/gz-rendering/package.nix new file mode 100644 index 0000000000000..8a94d2700e0f9 --- /dev/null +++ b/pkgs/by-name/gz/gz-rendering/package.nix @@ -0,0 +1,109 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + pkg-config, + gz-cmake, + gz-common, + gz-math, + gz-plugin, + eigen, + libGL, + libx11, + ogre-next-2, + spdlog, + vulkan-headers, + vulkan-loader, + python3, + gtest, + testers, + nix-update-script, +}: +let + version = "10.0.1"; + versionPrefix = "gz-rendering${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-rendering"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-rendering"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-gnNGe/yk+ucwPviaa6FusLD9Kp3SXKhnAChyNQhRzrM="; + }; + + patches = [ + # Mark GL3Plus plugin as optional on macOS where Metal is the primary + # render system and GL3Plus may not be available. + # TODO: Remove after update to > 10.0.1 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-rendering/commit/2e92a11bffd923e6b83a27a25cee9702cf6f34ef.patch?full_index=1"; + hash = "sha256-/PNGHDTuQoRl0WkWRrCjlITCzBzL9IjqSkSgrhFGeqA="; + }) + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + cmakeFlags = [ + # Upstream CMake uses CMAKE_INSTALL_PREFIX/${CMAKE_INSTALL_LIBDIR} to build + # the compiled-in plugin search path. Nix sets CMAKE_INSTALL_LIBDIR to an + # absolute store path, producing a doubled prefix. Force it to be relative. + "-DCMAKE_INSTALL_LIBEXECDIR=libexec" + "-DCMAKE_INSTALL_LIBDIR=lib" + ]; + + buildInputs = [ + gz-cmake + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + libx11 + vulkan-headers + vulkan-loader + ]; + + propagatedBuildInputs = [ + gz-common + gz-math + gz-plugin + eigen + libGL + ogre-next-2 + spdlog + ]; + + nativeCheckInputs = [ python3 ]; + + checkInputs = [ gtest ]; + + # Requires GPU/display server (unavailable in Nix sandbox) + doCheck = false; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "C++ library for rendering designed for robot simulation"; + homepage = "https://github.com/gazebosim/gz-rendering"; + changelog = "https://github.com/gazebosim/gz-rendering/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-rendering" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-sensors/package.nix b/pkgs/by-name/gz/gz-sensors/package.nix new file mode 100644 index 0000000000000..515aa0d06015f --- /dev/null +++ b/pkgs/by-name/gz/gz-sensors/package.nix @@ -0,0 +1,96 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + gz-cmake, + gz-common, + gz-math, + gz-msgs, + gz-rendering, + gz-transport, + sdformat, + gz-utils, + eigen, + protobuf, + ctestCheckHook, + python3, + gtest, + testers, + nix-update-script, +}: +let + version = "10.0.1"; + versionPrefix = "gz-sensors${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-sensors"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-sensors"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-dBeqnONAV8SedLPirehY7KPvf/Ae9ux7Tda2eH1vM7E="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + protobuf + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + gz-common + gz-math + gz-msgs + gz-rendering + gz-transport + sdformat + gz-utils + eigen + protobuf + ]; + + cmakeFlags = [ + # Requires GPU/display server (unavailable in Nix sandbox); + # non-rendering tests (air_pressure, altimeter, imu, etc.) still run. + "-DDRI_TESTS=OFF" + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; + + checkInputs = [ gtest ]; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Sensor models for robot simulation with Gazebo"; + homepage = "https://github.com/gazebosim/gz-sensors"; + changelog = "https://github.com/gazebosim/gz-sensors/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-sensors" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-sim/package.nix b/pkgs/by-name/gz/gz-sim/package.nix new file mode 100644 index 0000000000000..cfbce20b60ce9 --- /dev/null +++ b/pkgs/by-name/gz/gz-sim/package.nix @@ -0,0 +1,274 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + pkg-config, + gz-cmake, + gz-common, + gz-fuel-tools, + gz-gui, + gz-math, + gz-msgs, + gz-physics, + gz-plugin, + gz-rendering, + gz-sensors, + gz-tools, + gz-transport, + gz-utils, + sdformat, + protobuf, + mesa, + qt6, + libwebsockets, + ffmpeg, + python3Packages, + gtest, + ctestCheckHook, + runCommand, + nix-update-script, +}: +let + version = "10.3.0"; + versionPrefix = "gz-sim${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-sim"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-sim"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-EnzynxbSOZugZJOlXOAK+JNe5zCMvpwkqnoKp0ijdzY="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + protobuf + python3Packages.python + python3Packages.pybind11 + ]; + + cmakeFlags = [ + # Nix sets CMAKE_INSTALL_LIBDIR to an absolute store path, which produces + # broken doubled paths in plugin search directories. Force it to be relative. + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_LIBEXECDIR=libexec" + ]; + + # Set plugin discovery paths so users don't need to export them manually. + # --set-default allows user overrides (e.g., nixGL for hardware GL/Vulkan). + # + # Joined into a single string as a workaround for wrap-qt6-apps-hook: its + # setup-hook does `qtWrapperArgs=(${qtWrapperArgs-})`, which under + # __structuredAttrs=true sees qtWrapperArgs as a bash array and truncates + # it to element 0. Pre-joining into one whitespace-separated string makes + # the re-split reproduce the full token list. Safe because no arg value + # contains whitespace. + qtWrapperArgs = lib.concatStringsSep " " ( + [ + "--set-default GZ_SIM_SYSTEM_PLUGIN_PATH ${placeholder "out"}/lib/gz-sim-${lib.versions.major version}/plugins" + "--set-default GZ_SIM_PHYSICS_ENGINE_PATH ${gz-physics}/lib/gz-physics-${lib.versions.major gz-physics.version}/engine-plugins" + "--set-default GZ_GUI_PLUGIN_PATH ${placeholder "out"}/lib/gz-sim-${lib.versions.major version}/plugins/gui:${gz-gui}/lib/gz-gui-${lib.versions.major gz-gui.version}/plugins" + "--prefix NIXPKGS_QT6_QML_IMPORT_PATH : ${placeholder "out"}/lib/gz-sim-${lib.versions.major version}/plugins/gui" + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + # EGL vendor discovery for non-NixOS systems. Mesa's EGL ICD lets + # libglvnd find an EGL implementation for both GUI and headless + # rendering. --set-default means users can override (e.g. for NVIDIA). + "--set-default __EGL_VENDOR_LIBRARY_FILENAMES ${mesa}/share/glvnd/egl_vendor.d/50_mesa.json" + # Vulkan ICD discovery for non-NixOS systems. Mesa's Lavapipe is a + # software Vulkan driver, suitable for headless and VMs without GPU + # Vulkan. --set-default means nixGL or the user can override for + # hardware Vulkan (e.g. NVIDIA). + "--set-default VK_DRIVER_FILES ${mesa}/share/vulkan/icd.d/lvp_icd.${stdenv.hostPlatform.parsed.cpu.name}.json" + ] + ); + + postInstall = '' + # Install a wrapped gz CLI that discovers all gz-* subcommands. + # In Nix, each gz-* package is in its own store path, so the hardcoded + # default in gz-tools' gz script only searches its own (empty) share/gz/. + # GZ_CONFIG_PATH tells the script where to find *.yaml command configs. + mkdir -p $out/bin + makeWrapper ${gz-tools}/bin/gz $out/bin/gz \ + --set-default GZ_CONFIG_PATH ${ + lib.concatStringsSep ":" [ + "${placeholder "out"}/share/gz" + "${gz-msgs}/share/gz" + "${gz-transport}/share/gz" + "${gz-gui}/share/gz" + "${gz-plugin}/share/gz" + "${gz-fuel-tools}/share/gz" + ] + } + ''; + + buildInputs = [ + gz-cmake + libwebsockets + ffmpeg + # gz-sim-main links libpython at runtime for embedded Python plugin support; + # nativeBuildInputs alone leaves it out of the rpath under strictDeps. + python3Packages.python + ]; + + propagatedBuildInputs = [ + gz-common + gz-fuel-tools + gz-gui + gz-msgs + gz-physics + gz-plugin + gz-rendering + gz-sensors + gz-tools + gz-transport + sdformat + qt6.qt5compat + qt6.qtbase + qt6.qtdeclarative + qt6.qtquick3d + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3Packages.python + ]; + + checkInputs = [ gtest ]; + + # gz-sim tests share a single gz-transport partition; running them in + # parallel causes "Another world of the same name is running" errors + # because multiple test binaries advertise the same transport topics. + enableParallelChecking = false; + + disabledTests = [ + # Requires network access (unavailable in Nix sandbox) + "INTEGRATION_breadcrumbs" + "INTEGRATION_save_world" + "INTEGRATION_spacecraft" + "INTEGRATION_drive_to_pose_controller_system" + "INTEGRATION_sdf_include" + "INTEGRATION_model_photo_shoot_default_joints" + "INTEGRATION_model_photo_shoot_random_joints" + "UNIT_SdfGenerator_TEST" + "UNIT_Util_TEST" + + # Requires gz-sim to be installed (calls find_package during check phase) + "INTEGRATION_examples_build" + + # Timing-sensitive under Nix build load + "PERFORMANCE_each" + "PERFORMANCE_ExpectData" + + # Physics precision failures + "INTEGRATION_joint_controller_system" + "INTEGRATION_physics_system" + "INTEGRATION_velocity_control_system" + "INTEGRATION_follow_actor_system" + "INTEGRATION_touch_plugin" + + # Expects plugins NOT to be found, but GZ_SIM_SYSTEM_PLUGIN_PATH + # (needed by other tests) exposes the build-tree plugins + "UNIT_EntityFeatureMap_TEST" + "UNIT_SystemLoader_TEST" + "UNIT_SimulationRunner_TEST" + + # Test overrides GZ_SIM_SYSTEM_PLUGIN_PATH with python/test/plugins, + # clobbering the build-tree lib/ path so all system plugins (physics, + # user-commands, scene-broadcaster, and the loader itself) are unfindable. + "INTEGRATION_python_system_loader" + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + # Qt/GUI tests abort or segfault on Linux without a display server + "UNIT_Gui_TEST" + "UNIT_Gui_clean_exit_TEST" + "UNIT_JointPositionController_TEST" + "UNIT_Plot3D_TEST" + "INTEGRATION_user_commands" + "INTEGRATION_log_system" + ] + ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ + # Physics precision failures on aarch64-linux (off-diagonal moments tolerance) + "INTEGRATION_mesh_inertia_calculation" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Distributed sim handshake requires UDP multicast (IP_ADD_MEMBERSHIP), + # which the macOS sandbox blocks (no __darwinAllowLocalNetworking) + "INTEGRATION_network_handshake" + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + # Physics precision failures on aarch64-darwin + "INTEGRATION_wheel_slip" + ]; + + preCheck = '' + # Point to the physics engine plugins (dartsim, bullet, etc.) from gz-physics + export GZ_SIM_PHYSICS_ENGINE_PATH=${gz-physics}/lib/gz-physics-${lib.versions.major gz-physics.version}/engine-plugins + export GZ_PHYSICS_INSTALL_PREFIX=${gz-physics} + + # Tests call getServerConfigPath() / getMediaInstallDir() which look under + # $out, but install hasn't run yet — stage the needed files manually. + mkdir -p $out/share/gz/gz-sim/media + cp ${finalAttrs.src}/include/gz/sim/server.config $out/share/gz/gz-sim/ + cp ${finalAttrs.src}/include/gz/sim/playback_server.config $out/share/gz/gz-sim/ + cp ${finalAttrs.src}/src/rendering/MaterialParser/gazebo.material $out/share/gz/gz-sim/media/ + + # Isolate gz-transport namespace from other concurrent builds + export GZ_PARTITION=nixbld_$$ + + # Let Python tests find gz-sim system plugins in the build tree + export GZ_SIM_SYSTEM_PLUGIN_PATH=$PWD/lib + + # Assemble a Python namespace package directory so tests can import + # gz.sim, gz.common, gz.math and sdformat + local pydir=$(mktemp -d) + mkdir -p $pydir/gz + cp $PWD/lib/sim* $pydir/gz/ + cp $PWD/lib/common* $pydir/gz/ + ln -s ${gz-math}/lib/python/gz/math* $pydir/gz/ + ln -s ${sdformat}/lib/python/sdformat* $pydir/ + export PYTHONPATH=$pydir:$PYTHONPATH + ''; + + doCheck = true; + + passthru = { + tests.simulation = + runCommand "gz-sim-smoke-test" + { + nativeBuildInputs = [ finalAttrs.finalPackage ]; + } + '' + # Some test cases use $HOME + export HOME=$(mktemp -d) + + export GZ_PARTITION=nixtest_$$ + + gz sim --headless-rendering -s -r --iterations 200 \ + ${finalAttrs.finalPackage}/share/gz/gz-sim/worlds/diff_drive.sdf + touch $out + ''; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Open-source robotics simulator for testing robot designs"; + homepage = "https://gazebosim.org/"; + changelog = "https://github.com/gazebosim/gz-sim/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + mainProgram = "gz"; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-tools/package.nix b/pkgs/by-name/gz/gz-tools/package.nix new file mode 100644 index 0000000000000..75b8e761ded81 --- /dev/null +++ b/pkgs/by-name/gz/gz-tools/package.nix @@ -0,0 +1,73 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + gz-cmake, + ruby, + testers, + nix-update-script, +}: +let + version = "2.0.3"; + versionPrefix = "gz-tools${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-tools"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-tools"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-xMFJylj7OnDc7zVWiI4a/mvNpu9scz83F3bGopCt8l8="; + }; + + patches = [ + # Use a relative path to find the backward library instead of relying on + # LD_LIBRARY_PATH/DYLD_LIBRARY_PATH or absolute paths + # TODO: Remove after update to > 2.0.3 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-tools/commit/48e36e4a44aae8ccbd09a805e337e5bfc528087c.patch?full_index=1"; + hash = "sha256-92EO3iXumMJxJPPZtPzvXyrSnW8Bj/fZLxYuxDKT8FU="; + }) + ]; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + gz-cmake + ruby + ]; + + doCheck = true; + + nativeCheckInputs = [ ruby ]; + + passthru = { + tests.version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "gz --help"; + version = finalAttrs.version; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Command line tools for the Gazebo libraries"; + homepage = "https://github.com/gazebosim/gz-tools"; + changelog = "https://github.com/gazebosim/gz-tools/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + mainProgram = "gz"; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-transport/package.nix b/pkgs/by-name/gz/gz-transport/package.nix new file mode 100644 index 0000000000000..520611639edb4 --- /dev/null +++ b/pkgs/by-name/gz/gz-transport/package.nix @@ -0,0 +1,153 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + pkg-config, + gz-cmake, + gz-msgs, + gz-utils, + protobuf, + zeromq, + cppzmq, + sqlite, + libsodium, + libuuid, + python3Packages, + ctestCheckHook, + gtest, + nix-update-script, + testers, +}: +let + version = "15.0.2"; + versionPrefix = "gz-transport${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gz-transport"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "gz-transport"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-9ple0Bz3tFno/ZjUi7f2dqU06g81W8w0IeIzRFrA0s8="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + protobuf + python3Packages.python + python3Packages.pybind11 + ]; + + buildInputs = [ + gz-cmake + # direct DT_NEEDED of libgz-transport.so (linked via zeromq) + libsodium + ]; + + propagatedBuildInputs = [ + gz-msgs + gz-utils + protobuf + zeromq + cppzmq + sqlite + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + libuuid + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3Packages.python + python3Packages.protobuf + ]; + + postPatch = '' + # The gz_TEST.cc bash-completion tests hardcode /usr/bin/bash which + # doesn't exist in the Nix sandbox. + substituteInPlace src/cmd/gz_TEST.cc \ + --replace-fail '/usr/bin/bash' '${stdenv.shell}' + ''; + + checkInputs = [ gtest ]; + + patches = [ + # Use ENVIRONMENT_MODIFICATION (prepend) instead of ENVIRONMENT (overwrite) + # for Python test PYTHONPATH — fixes broken CMAKE_INSTALL_PREFIX paths + # and allows the shell env to provide dependency paths. + # TODO: Remove after update to > 15.0.2 + (fetchpatch2 { + url = "https://github.com/gazebosim/gz-transport/commit/c589565d9708f2e59ebbd546c0ddc00674242b29.patch?full_index=1"; + hash = "sha256-KFBX7waIeT+XG+htTyGMRkAplY5Jwq/aofxG3SrdWaI="; + }) + ]; + + disabledTests = [ + # Timing-sensitive under Nix build load + "INTEGRATION_twoProcsSrvCallSync1" + ] + ++ lib.optionals stdenv.hostPlatform.isAarch64 [ + # Timing-sensitive under Nix build load + "INTEGRATION_twoProcsPubSub" + "INTEGRATION_playback" + "INTEGRATION_recorder" + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + # Timing-sensitive under Nix build load + "INTEGRATION_twoProcsPubSubStats" + "INTEGRATION_twoProcsSrvCallStress" + "INTEGRATION_twoProcsSrvCallSync1" + "INTEGRATION_twoProcsSrvCallWithoutInput" + "INTEGRATION_twoProcsSrvCallWithoutInputSync1" + "INTEGRATION_twoProcsSrvCallWithoutInputStress" + "INTEGRATION_twoProcsSrvCallWithoutOutput" + "UNIT_Node_TEST" + "UNIT_gz_TEST" + ]; + + preCheck = '' + # Set up Python package structure for build-tree pybind11 module so tests can + # import gz.transport. Merge with gz-msgs to handle the gz namespace package. + local pydir=$(mktemp -d) + mkdir -p $pydir/gz/transport + cp $PWD/lib/_transport* $pydir/gz/transport/ + if [ -f $NIX_BUILD_TOP/source/python/gz/transport/__init__.py ]; then + cp $NIX_BUILD_TOP/source/python/gz/transport/__init__.py $pydir/gz/transport/ + else + echo "from gz.transport._transport import *" > $pydir/gz/transport/__init__.py + fi + + # Symlink gz-msgs into the same gz namespace so Python can find both + ln -s ${gz-msgs}/lib/python/gz/msgs $pydir/gz/msgs + export PYTHONPATH=$pydir:${python3Packages.protobuf}/${python3Packages.python.sitePackages}:$PYTHONPATH + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Communication library for robot simulation using publish/subscribe and services"; + homepage = "https://github.com/gazebosim/gz-transport"; + changelog = "https://github.com/gazebosim/gz-transport/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "gz-transport" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/by-name/gz/gz-utils/package.nix b/pkgs/by-name/gz/gz-utils/package.nix index 6ce8d479f6725..7a39c35b70bbd 100644 --- a/pkgs/by-name/gz/gz-utils/package.nix +++ b/pkgs/by-name/gz/gz-utils/package.nix @@ -14,19 +14,27 @@ spdlog, # nativeCheckInputs + ctestCheckHook, python3, # checkInputs gtest, + + nix-update-script, + testers, }: +let + version = "4.0.0"; + versionPrefix = "gz-utils${lib.versions.major version}"; +in stdenv.mkDerivation (finalAttrs: { pname = "gz-utils"; - version = "4.0.0"; + inherit version; src = fetchFromGitHub { owner = "gazebosim"; repo = "gz-utils"; - tag = "gz-utils${lib.versions.major finalAttrs.version}_${finalAttrs.version}"; + tag = "${versionPrefix}_${finalAttrs.version}"; hash = "sha256-fZonC/o5CNHdK/R3IgEoo1llehy36MwvXPQCgFnP8Ls="; }; @@ -45,12 +53,15 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ cmake - gz-cmake doxygen graphviz ]; - buildInputs = [ + propagatedNativeBuildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ cli11 spdlog ]; @@ -67,18 +78,34 @@ stdenv.mkDerivation (finalAttrs: { cp -r doxygen/html $doc ''; - nativeCheckInputs = [ python3 ]; + nativeCheckInputs = [ + ctestCheckHook + python3 + ]; checkInputs = [ gtest ]; doCheck = true; + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + meta = { description = "General purpose utility classes and functions for the Gazebo libraries"; homepage = "https://gazebosim.org/home"; changelog = "https://github.com/gazebosim/gz-utils/blob/${finalAttrs.src.tag}/Changelog.md"; license = lib.licenses.asl20; - platforms = lib.platforms.unix ++ lib.platforms.windows; - maintainers = with lib.maintainers; [ guelakais ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin ++ lib.platforms.windows; + pkgConfigModules = [ "gz-utils" ]; + maintainers = with lib.maintainers; [ + guelakais + taylorhoward92 + ]; }; }) diff --git a/pkgs/by-name/og/ogre-next-2/package.nix b/pkgs/by-name/og/ogre-next-2/package.nix new file mode 100644 index 0000000000000..3dc745cade705 --- /dev/null +++ b/pkgs/by-name/og/ogre-next-2/package.nix @@ -0,0 +1,214 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + testers, + + addDriverRunpath, + autoAddDriverRunpath, + apple-sdk_15, + cmake, + freetype, + libGL, + libx11, + libxaw, + libxcb, + libxrandr, + libxt, + ninja, + openvr, + pkg-config, + rapidjson, + SDL2, + tinyxml, + shaderc, + vulkan-headers, + vulkan-loader, + zlib, + zziplib, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "ogre-next"; + version = "2.3.3"; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "OGRECave"; + repo = "ogre-next"; + tag = "v${finalAttrs.version}"; + hash = "sha256-elSj35LwsLzj1ssDPsk9NW/KSXfiOGYmw9hQSAWdpFM="; + }; + + patches = [ + # Backport from v2-3 branch: implement STBIImageCodec::magicNumberToFileExt() + # so Image2::load() can identify PNG/JPEG files by magic bytes. + # Without this, TextureGpuManager texture loading crashes. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/65e6a9bad2a2e8e8839a0b62b8a54d64e368a492.patch?full_index=1"; + hash = "sha256-Zw6pFjHbDezbO79SLD/yo9tblgph1PKH58PV7r1dcZM="; + }) + + # Backport from v2-3 branch: fix infinite-loop typo (x << width → x < width) + # and wrong source stride in RGB→RGBA conversion in STBICodec::decode(). + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/5d2767e201f36e85ce8fb641449b87262e9674df.patch?full_index=1"; + hash = "sha256-MgqoU9cw0vJcgI7hLuqlVRFdmOTwmQ93FBTgzDl69hg="; + }) + + # Fix RGB channel swap in STBICodec RGB→RGBA conversion: stb returns + # RGB but the code wrote r,g,b (actually B,G,R) into PFG_RGBA8_UNORM. + # master (v3-0) already has the correct write order; this backports it. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/e0126edeb3bc442741a8735c7221ae92024a5c14.patch?full_index=1"; + hash = "sha256-WU/91+H7z8bUzFc0XH2zGc3Yv7Th0beVxdRFy9JWpDo="; + }) + + # Skip NSWindow creation for hidden (offscreen) Metal windows. + # NSWindow must be created on the main thread on macOS; skipping it + # makes hidden windows safe to create from any thread, analogous to + # VulkanWindowNull in the Vulkan backend. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/pull/566.patch"; + hash = "sha256-VG3qyVC8QZUe3AmzmIAIsb5Y0rUEqNWRMu5kt30Xllc="; + }) + + # GCC 15 enforces CWG DR 1518: explicit default constructors cannot be + # used in copy-list-initialization. Make STLAllocator's constructors + # constexpr (and non-explicit) so STL containers can value-initialize + # their allocator. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/8ec6166ea3a6453950edfba8a32d0e3fa5099833.patch?full_index=1"; + hash = "sha256-Hs+seuQrQZY9G6H4NqV4QVevtDyBzd+qMyvxIK+buBI="; + }) + + # Guard macOS framework post-build commands (ditto, mkdir) behind + # OGRE_BUILD_LIBS_AS_FRAMEWORKS so they are skipped when disabled. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/06c53d072271276e07aef2233114a2dc5fa18ae2.patch?full_index=1"; + hash = "sha256-tU8V/E2yWVkk7jp29t9oFeNH+sZwMjEdKONdGDcjjP4="; + }) + + # Respect externally-set CMAKE_OSX_SYSROOT on macOS instead of + # unconditionally overriding it via xcodebuild. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/0630ccd923160c4c489d1b8eefe7e39a89807a30.patch?full_index=1"; + hash = "sha256-pXlBWtsxkFAk/ffRJHv0lZwLYLHOJ5219cnfKJP/+Xk="; + }) + + # Fix pkgconfig plugindir on macOS: plugins install to lib/ directly, + # not lib/OGRE/. + # TODO: Remove after update to > 2.3.3 + (fetchpatch2 { + url = "https://github.com/OGRECave/ogre-next/commit/f6b76053837674d879ab1eafca23cab1c1cf10f2.patch?full_index=1"; + hash = "sha256-lkSLBYg3i144Nj7tcFTXs5wF63LodSy1wEpe/cHRjsk="; + }) + ]; + + nativeBuildInputs = [ + cmake + ninja + pkg-config + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + autoAddDriverRunpath + ]; + + buildInputs = [ + SDL2 + freetype + rapidjson + tinyxml + zlib + zziplib + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + libGL + libx11 + libxaw + libxcb + libxrandr + libxt + openvr + shaderc.dev + shaderc.static + vulkan-headers + vulkan-loader + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + apple-sdk_15 + ]; + + cmakeFlags = [ + (lib.cmakeBool "OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS" true) + # Use STB instead of FreeImage (marked insecure in nixpkgs) + (lib.cmakeBool "OGRE_CONFIG_ENABLE_FREEIMAGE" false) + (lib.cmakeBool "OGRE_CONFIG_ENABLE_STBI" true) + # Framework bundles are incompatible with the Nix store + (lib.cmakeBool "OGRE_BUILD_LIBS_AS_FRAMEWORKS" false) + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + # OGRE-Next is a fork of OGRE; use the "OgreNext" library prefix + # (e.g. OgreNextMain, OgreNextHlmsPbs) to avoid conflicts with OGRE 1.x. + # macOS retains the "OGRE" name by convention (matching Homebrew builds). + (lib.cmakeBool "OGRE_USE_NEW_PROJECT_NAME" true) + # Render systems: GL3Plus and Vulkan are Linux-only; the GL3Plus window + # subsystem is not ported to the 2.x series on macOS, and Vulkan uses + # XCB windowing which is Linux-only. + (lib.cmakeBool "OGRE_BUILD_RENDERSYSTEM_GL3PLUS" true) + (lib.cmakeBool "OGRE_GLSUPPORT_USE_EGL_HEADLESS" true) + (lib.cmakeBool "OGRE_BUILD_RENDERSYSTEM_VULKAN" true) + # Headless Vulkan rendering (no display server required) + (lib.cmakeBool "OGRE_VULKAN_WINDOW_NULL" true) + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # GL3Plus and Vulkan are not available on macOS; Metal is the + # primary render system (built automatically when on Darwin). + (lib.cmakeBool "OGRE_BUILD_RENDERSYSTEM_GL3PLUS" false) + (lib.cmakeBool "OGRE_BUILD_RENDERSYSTEM_VULKAN" false) + ] + ++ lib.optionals stdenv.hostPlatform.isAarch64 [ + # NEON and SSE2 SIMD paths cause build failures on aarch64 + (lib.cmakeBool "OGRE_SIMD_NEON" false) + (lib.cmakeBool "OGRE_SIMD_SSE2" false) + ]; + + passthru.tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + # On Linux OGRE_USE_NEW_PROJECT_NAME renames modules to OGRE-Next-*; + # on macOS they retain the OGRE-* prefix. + moduleNames = + if stdenv.hostPlatform.isLinux then + [ + "OGRE-Next" + "OGRE-Next-Hlms" + "OGRE-Next-MeshLodGenerator" + "OGRE-Next-Overlay" + ] + else + [ + "OGRE" + "OGRE-Hlms" + "OGRE-MeshLodGenerator" + "OGRE-Overlay" + ]; + versionCheck = true; + }; + + meta = { + description = "3D Object-Oriented Graphics Rendering Engine (2.x series)"; + homepage = "https://www.ogre3d.org/"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +}) diff --git a/pkgs/by-name/sd/sdformat/package.nix b/pkgs/by-name/sd/sdformat/package.nix new file mode 100644 index 0000000000000..2eb60c8715a55 --- /dev/null +++ b/pkgs/by-name/sd/sdformat/package.nix @@ -0,0 +1,97 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + gz-cmake, + gz-math, + gz-utils, + tinyxml-2, + python3Packages, + ruby, + ctestCheckHook, + gtest, + nix-update-script, + testers, +}: +let + version = "16.0.1"; + versionPrefix = "sdformat${lib.versions.major version}"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "sdformat"; + inherit version; + + strictDeps = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "gazebosim"; + repo = "sdformat"; + tag = "${versionPrefix}_${finalAttrs.version}"; + hash = "sha256-WhbPVzlR8p89bqtzqGjfGJbTjOHjdlm7mMxhvyHmZjA="; + }; + + nativeBuildInputs = [ + cmake + python3Packages.python + python3Packages.pybind11 + ]; + + buildInputs = [ + gz-cmake + ]; + + propagatedBuildInputs = [ + gz-math + gz-utils + tinyxml-2 + ]; + + nativeCheckInputs = [ + ctestCheckHook + python3Packages.python + ruby + ]; + + checkInputs = [ gtest ]; + + patches = [ + # Use ENVIRONMENT_MODIFICATION (prepend) instead of ENVIRONMENT (overwrite) + # for Python test PYTHONPATH — fixes broken CMAKE_INSTALL_PREFIX paths + # and allows the shell env to provide dependency paths. + # TODO: Remove after update to > 16.0.1 + (fetchpatch2 { + url = "https://github.com/gazebosim/sdformat/commit/855596c16fa34fe0fd18b883249a77402a1943c9.patch?full_index=1"; + hash = "sha256-9lYlcaU0BoHqYB1riS3IzERMtbL5/xZDl9c7v+15DHQ="; + }) + ]; + + preCheck = '' + # Python tests import gz-math bindings, which live in Nix store paths + # not on any default search path in the sandbox. + export PYTHONPATH=${gz-math}/lib/python/:$PYTHONPATH + ''; + + doCheck = true; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + updateScript = nix-update-script { + extraArgs = [ "--version-regex=${versionPrefix}_([\\d\\.]+)" ]; + }; + }; + + meta = { + description = "Simulation Description Format (SDF) parser and description files"; + homepage = "https://sdformat.org/"; + changelog = "https://github.com/gazebosim/sdformat/blob/${finalAttrs.src.tag}/Changelog.md"; + license = lib.licenses.asl20; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + pkgConfigModules = [ "sdformat" ]; + maintainers = with lib.maintainers; [ taylorhoward92 ]; + }; +}) diff --git a/pkgs/development/python-modules/gz-math/default.nix b/pkgs/development/python-modules/gz-math/default.nix new file mode 100644 index 0000000000000..ec58dd587b3ac --- /dev/null +++ b/pkgs/development/python-modules/gz-math/default.nix @@ -0,0 +1,41 @@ +{ + lib, + stdenv, + toPythonModule, + python, + pkgs, +}: + +let + gz-math = pkgs.gz-math.override { python3Packages = python.pkgs; }; +in +toPythonModule ( + stdenv.mkDerivation { + pname = "gz-math"; + inherit (gz-math) version; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + mkdir -p "$out/${python.sitePackages}" + cp -r ${gz-math}/lib/python/. "$out/${python.sitePackages}/" + runHook postInstall + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ python ]; + installCheckPhase = '' + runHook preInstallCheck + PYTHONPATH="$out/${python.sitePackages}''${PYTHONPATH:+:$PYTHONPATH}" \ + ${python.pythonOnBuildForHost.interpreter} -c "import gz.math" + runHook postInstallCheck + ''; + + meta = gz-math.meta // { + description = "Python bindings for gz-math"; + }; + } +) diff --git a/pkgs/development/python-modules/gz-msgs/default.nix b/pkgs/development/python-modules/gz-msgs/default.nix new file mode 100644 index 0000000000000..aec89b1b22a62 --- /dev/null +++ b/pkgs/development/python-modules/gz-msgs/default.nix @@ -0,0 +1,44 @@ +{ + lib, + stdenv, + toPythonModule, + python, + pkgs, + protobuf, +}: + +let + gz-msgs = pkgs.gz-msgs.override { python3Packages = python.pkgs; }; +in +toPythonModule ( + stdenv.mkDerivation { + pname = "gz-msgs"; + inherit (gz-msgs) version; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + propagatedBuildInputs = [ protobuf ]; + + installPhase = '' + runHook preInstall + mkdir -p "$out/${python.sitePackages}" + cp -r ${gz-msgs}/lib/python/. "$out/${python.sitePackages}/" + runHook postInstall + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ python ]; + installCheckPhase = '' + runHook preInstallCheck + PYTHONPATH="$out/${python.sitePackages}:${protobuf}/${python.sitePackages}''${PYTHONPATH:+:$PYTHONPATH}" \ + ${python.pythonOnBuildForHost.interpreter} -c "import gz.msgs.vector3d_pb2" + runHook postInstallCheck + ''; + + meta = gz-msgs.meta // { + description = "Python bindings for gz-msgs"; + }; + } +) diff --git a/pkgs/development/python-modules/gz-sim/default.nix b/pkgs/development/python-modules/gz-sim/default.nix new file mode 100644 index 0000000000000..76d10ed017e7c --- /dev/null +++ b/pkgs/development/python-modules/gz-sim/default.nix @@ -0,0 +1,52 @@ +{ + lib, + stdenv, + toPythonModule, + python, + pkgs, + gz-math, + gz-msgs, + gz-transport, + sdformat, +}: + +let + gz-sim = pkgs.gz-sim.override { python3Packages = python.pkgs; }; +in +toPythonModule ( + stdenv.mkDerivation { + pname = "gz-sim"; + inherit (gz-sim) version; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + propagatedBuildInputs = [ + gz-math + gz-msgs + gz-transport + sdformat + ]; + + installPhase = '' + runHook preInstall + mkdir -p "$out/${python.sitePackages}" + cp -r ${gz-sim}/lib/python/. "$out/${python.sitePackages}/" + runHook postInstall + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ python ]; + installCheckPhase = '' + runHook preInstallCheck + PYTHONPATH="$out/${python.sitePackages}:${gz-math}/${python.sitePackages}:${sdformat}/${python.sitePackages}''${PYTHONPATH:+:$PYTHONPATH}" \ + ${python.pythonOnBuildForHost.interpreter} -c "import gz.sim; import gz.common" + runHook postInstallCheck + ''; + + meta = gz-sim.meta // { + description = "Python bindings for gz-sim"; + }; + } +) diff --git a/pkgs/development/python-modules/gz-transport/default.nix b/pkgs/development/python-modules/gz-transport/default.nix new file mode 100644 index 0000000000000..fcf6587a0b3b4 --- /dev/null +++ b/pkgs/development/python-modules/gz-transport/default.nix @@ -0,0 +1,44 @@ +{ + lib, + stdenv, + toPythonModule, + python, + pkgs, + gz-msgs, +}: + +let + gz-transport = pkgs.gz-transport.override { python3Packages = python.pkgs; }; +in +toPythonModule ( + stdenv.mkDerivation { + pname = "gz-transport"; + inherit (gz-transport) version; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + propagatedBuildInputs = [ gz-msgs ]; + + installPhase = '' + runHook preInstall + mkdir -p "$out/${python.sitePackages}" + cp -r ${gz-transport}/lib/python/. "$out/${python.sitePackages}/" + runHook postInstall + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ python ]; + installCheckPhase = '' + runHook preInstallCheck + PYTHONPATH="$out/${python.sitePackages}''${PYTHONPATH:+:$PYTHONPATH}" \ + ${python.pythonOnBuildForHost.interpreter} -c "import gz.transport" + runHook postInstallCheck + ''; + + meta = gz-transport.meta // { + description = "Python bindings for gz-transport"; + }; + } +) diff --git a/pkgs/development/python-modules/sdformat/default.nix b/pkgs/development/python-modules/sdformat/default.nix new file mode 100644 index 0000000000000..eda4f74dd88ec --- /dev/null +++ b/pkgs/development/python-modules/sdformat/default.nix @@ -0,0 +1,44 @@ +{ + lib, + stdenv, + toPythonModule, + python, + pkgs, + gz-math, +}: + +let + sdformat = pkgs.sdformat.override { python3Packages = python.pkgs; }; +in +toPythonModule ( + stdenv.mkDerivation { + pname = "sdformat"; + inherit (sdformat) version; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + propagatedBuildInputs = [ gz-math ]; + + installPhase = '' + runHook preInstall + mkdir -p "$out/${python.sitePackages}" + cp -r ${sdformat}/lib/python/. "$out/${python.sitePackages}/" + runHook postInstall + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ python ]; + installCheckPhase = '' + runHook preInstallCheck + PYTHONPATH="$out/${python.sitePackages}:${gz-math}/${python.sitePackages}''${PYTHONPATH:+:$PYTHONPATH}" \ + ${python.pythonOnBuildForHost.interpreter} -c "import sdformat" + runHook postInstallCheck + ''; + + meta = sdformat.meta // { + description = "Python bindings for sdformat"; + }; + } +) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 05a2e2645ad08..8f8777d9fad23 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6837,6 +6837,14 @@ self: super: with self; { gyp = callPackage ../development/python-modules/gyp { }; + gz-math = callPackage ../development/python-modules/gz-math { }; + + gz-msgs = callPackage ../development/python-modules/gz-msgs { }; + + gz-sim = callPackage ../development/python-modules/gz-sim { }; + + gz-transport = callPackage ../development/python-modules/gz-transport { }; + h11 = callPackage ../development/python-modules/h11 { }; h2 = callPackage ../development/python-modules/h2 { }; @@ -17431,6 +17439,8 @@ self: super: with self; { sdflit = callPackage ../development/python-modules/sdflit { }; + sdformat = callPackage ../development/python-modules/sdformat { }; + sdjson = callPackage ../development/python-modules/sdjson { }; sdkmanager = callPackage ../development/python-modules/sdkmanager { };