mirror of
https://github.com/lopsided98/nix-ros-overlay.git
synced 2025-06-10 01:42:24 +03:00
buildEnv: add Python packages to environment and set LD_LIBRARY_PATH
Now that we set PYTHONPATH in the wrappers, we can add Python packages to the environment as well. This is necessary to make certain ros2cli commands work (e.g. ros2launch). Also, ROS2 loads the RMW implementation dynamically, so we need to set LD_LIBRARY_PATH in the wrappers.
This commit is contained in:
parent
0676fb9572
commit
c0077930c0
1 changed files with 6 additions and 5 deletions
|
@ -3,10 +3,10 @@
|
|||
# otherwise cause ROS_PACKAGE_PATH or other environment variables to become too
|
||||
# long.
|
||||
#
|
||||
# All ROS packages in the 'paths' closure are added to the environment, while
|
||||
# other packages are propagated. This makes it usable in nix-shell, while
|
||||
# preventing ROS_PACKAGE_PATH and CMAKE_PREFIX_PATH from becoming too large due
|
||||
# to a huge number of ROS packages.
|
||||
# All ROS and Python packages in the 'paths' closure are added to the
|
||||
# environment, while other packages are propagated. This makes it usable in
|
||||
# nix-shell, while preventing ROS_PACKAGE_PATH and CMAKE_PREFIX_PATH from
|
||||
# becoming too large due to a huge number of ROS packages.
|
||||
#
|
||||
# By default, all binaries in the environment are wrapped, setting the relevant
|
||||
# ROS environment variables, allowing use outside of nix-shell.
|
||||
|
@ -18,7 +18,7 @@ with lib;
|
|||
let
|
||||
propagatePackages = packages: let
|
||||
validPackages = filter (d: d != null) packages;
|
||||
partitionedPackages = partition (d: d.rosPackage or false) validPackages;
|
||||
partitionedPackages = partition (d: (d.rosPackage or false) || (hasAttr "pythonModule" d)) validPackages;
|
||||
rosPackages = partitionedPackages.right;
|
||||
otherPackages = partitionedPackages.wrong;
|
||||
rosPropagatedPackages = unique (concatLists (catAttrs "propagatedBuildInputs" rosPackages));
|
||||
|
@ -58,6 +58,7 @@ let
|
|||
|
||||
makeWrapper "$file" "$link" \
|
||||
--prefix PATH : "$out/bin" \
|
||||
--prefix LD_LIBRARY_PATH : "$out/lib" \
|
||||
--prefix PYTHONPATH : "$out/${python.sitePackages}" \
|
||||
--prefix CMAKE_PREFIX_PATH : "$out" \
|
||||
--prefix AMENT_PREFIX_PATH : "$out" \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue