diff --git a/distros/ament-package-setup-hook.sh b/distros/ament-cmake-core-setup-hook.sh similarity index 59% rename from distros/ament-package-setup-hook.sh rename to distros/ament-cmake-core-setup-hook.sh index f9a37105d6..cf740d89c7 100644 --- a/distros/ament-package-setup-hook.sh +++ b/distros/ament-cmake-core-setup-hook.sh @@ -21,3 +21,11 @@ _findAmentPackages() { _amentPackagesSeen["$pkg"]=1 } addEnvHooks "$hostOffset" _findAmentPackages + +_amentCmakeCorePreConfigureHook() { + # Don't create share/ament_index/resource_index/parent_prefix_path resource + # that contains references to all dependencies. This file isn't used with Nix + # and just bloats the closure. + cmakeFlags+=" -DAMENT_CMAKE_ENVIRONMENT_PARENT_PREFIX_PATH_GENERATION=OFF" +} +preConfigureHooks+=(_amentCmakeCorePreConfigureHook) diff --git a/distros/distro-overlay.nix b/distros/distro-overlay.nix index dda221eb7c..1e206e042a 100644 --- a/distros/distro-overlay.nix +++ b/distros/distro-overlay.nix @@ -24,8 +24,8 @@ let overrides = rosSelf: rosSuper: with rosSelf.lib; { # ROS package overrides/fixups - ament-package = rosSuper.ament-package.overrideAttrs ({ ... }: { - setupHook = ./ament-package-setup-hook.sh; + ament-cmake-core = rosSuper.ament-cmake-core.overrideAttrs ({ ... }: { + setupHook = ./ament-cmake-core-setup-hook.sh; }); camera-calibration-parsers = patchBoostPython rosSuper.camera-calibration-parsers; @@ -248,13 +248,9 @@ let rmw-implementation = rosSuper.rmw-implementation.overrideAttrs ({ propagatedBuildInputs ? [], ... }: { - # Make sure all supported implementations are available to dependent - # packages. They are already part of the closure, so we might as well - # support them. This package could also be overriden to only support a - # single implementation to reduce closure size. + # The default implementation must be available to all dependent packages + # at build time. propagatedBuildInputs = with rosSelf; [ - rmw-connext-cpp - rmw-cyclonedds-cpp rmw-fastrtps-cpp ] ++ propagatedBuildInputs; }); diff --git a/examples/ros2-basic.nix b/examples/ros2-basic.nix index 020d40af97..c27dcc0ff8 100755 --- a/examples/ros2-basic.nix +++ b/examples/ros2-basic.nix @@ -10,7 +10,11 @@ mkShell { ros-environment ros2topic ros2node + geometry-msgs + rmw-fastrtps-dynamic-cpp ]; }) ]; + + RMW_IMPLEMENTATION = "rmw_fastrtps_dynamic_cpp"; }