nix-ros-overlay/distros/distro-overlay.nix

387 lines
12 KiB
Nix
Raw Permalink Normal View History

{ version, distro }:
2019-04-16 15:02:56 -04:00
self: super:
let
pythonOverridesFor = with self.lib; prevPython: prevPython // {
pkgs = prevPython.pkgs.overrideScope (pyFinal: pyPrev: {
wxPython = pyFinal.wxPython_4_2;
# ROS is not compatible with empy 4
empy = pyFinal.empy_3;
});
};
base = rosSelf: rosSuper: {
2022-07-04 21:01:47 -04:00
recurseForDerivations = true;
lib = super.lib // import ../lib { inherit self rosSelf; };
callPackage = self.newScope rosSelf;
buildRosPackage = rosSelf.callPackage ./build-ros-package {
rosVersion = version;
rosDistro = distro;
};
buildEnv = rosSelf.callPackage ./build-env {
inherit (self) buildEnv;
};
python3 = pythonOverridesFor rosSelf.rosPython or self.python3;
python3Packages = rosSelf.python3.pkgs;
2022-01-09 12:06:17 -05:00
boost = self.boost.override {
python = rosSelf.python;
enablePython = true;
};
};
mrptOverrides = rosSelf: rosSuper:
let
patchMrptExternalProjectGit = pkg:
with rosSuper.lib;
patchExternalProjectGit pkg {
url = "https://github.com/MRPT/mrpt.git";
originalRev = "\\\\\${MRPT_VERSION_TO_DOWNLOAD}";
# CMakeLists.txt sets MRPT_VERSION_TO_DOWNLOAD to the
# version from package.xml
rev = head (splitString "-" pkg.version); # Ignore ROS release such as "-r1".
2024-11-14 22:51:36 -05:00
fetchgitArgs.hash = "sha256-w9LxOtbXw01B2i4aqbhAIjjDwHzC+OvZbcZG/Pyn71Q=";
};
in rosSuper.lib.genAttrs [
"mrpt-apps"
"mrpt-libapps"
"mrpt-libbase"
"mrpt-libgui"
"mrpt-libhwdrivers"
"mrpt-libmaps"
"mrpt-libmath"
"mrpt-libnav"
"mrpt-libobs"
"mrpt-libopengl"
"mrpt-libposes"
"mrpt-libros-bridge"
"mrpt-libslam"
"mrpt-libtclap"
] (name: patchMrptExternalProjectGit rosSuper.${name});
2019-12-06 17:18:47 -05:00
overrides = rosSelf: rosSuper: with rosSelf.lib; {
# ROS package overrides/fixups
# Some third-party packages are available in rodistro,
# but have a better packaging in nixpkgs, so use it instead
inherit (self.python3Packages) eigenpy hpp-fcl pinocchio ;
2019-05-12 19:09:30 -04:00
gazebo-ros = rosSuper.gazebo-ros.overrideAttrs ({ ... }:{
setupHook = ./gazebo-ros-setup-hook.sh;
});
2019-12-10 12:13:57 -05:00
gtsam = rosSuper.gtsam.overrideAttrs ({
cmakeFlags ? [], ...
}: {
# Don't use vendored version of Eigen, which can collide with
# Eigen version in dependent packages.
cmakeFlags = cmakeFlags ++ [ "-DGTSAM_USE_SYSTEM_EIGEN=ON" ];
});
joint-state-publisher-gui = rosSuper.joint-state-publisher-gui.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/joint_state_publisher_gui/joint_state_publisher_gui"
'';
});
2020-12-18 00:14:43 -05:00
librealsense2 = rosSuper.librealsense2.overrideAttrs ({
buildInputs ? [], ...
2020-12-18 00:14:43 -05:00
}: {
buildInputs = buildInputs ++ [ self.glfw self.libGLU ];
});
2020-04-16 20:19:15 -04:00
mapviz = rosSuper.mapviz.overrideAttrs ({
nativeBuildInputs ? [],
postFixup ? "", ...
}: {
dontWrapQtApps = false;
2020-04-16 20:19:15 -04:00
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/mapviz/mapviz"
'';
});
2020-02-04 15:18:18 -05:00
mavlink = rosSuper.mavlink.overrideAttrs ({
2020-02-09 17:40:10 -05:00
postPatch ? "", ...
2020-02-04 15:18:18 -05:00
}: {
postPatch = postPatch + ''
substituteInPlace CMakeLists.txt --replace-fail /usr/bin/env '${self.buildPackages.coreutils}/bin/env'
2020-02-04 15:18:18 -05:00
patchShebangs pymavlink/tools/mavgen.py
'';
2020-05-24 13:24:58 -04:00
ROS_PYTHON_VERSION = if rosSelf.python.isPy3k then 3 else 2;
});
osqp-vendor = pipe rosSuper.osqp-vendor [
(pkg: pkg.overrideAttrs ({
preInstall ? "", ...
}: {
# osqp installs into both lib/cmake/ and lib64/cmake/ which is
# problematic because moveLib64 doesn't attempt to merge overlapping
# directories but fails instead. Here we do the merge manually.
preInstall = preInstall + ''
mkdir -p ./osqp_install/lib/cmake/osqp
mv ./osqp_install/lib64/cmake/osqp/* ./osqp_install/lib/cmake/osqp
rm -r ./osqp_install/lib64/cmake
'';
}))
(pkg: patchExternalProjectGit pkg {
url = "https://github.com/osqp/osqp.git";
rev = "v0.6.2";
revVariable = "git_tag";
2025-03-01 10:21:27 -05:00
fetchgitArgs.hash = "sha256-RYk3zuZrJXPcF27eMhdoZAio4DZ+I+nFaUEg1g/aLNk=";
})
];
ompl = rosSuper.ompl.overrideAttrs ({
patches ? [], ...
}: {
patches = patches ++ [
# Fix pkg-config paths
(self.fetchpatch {
url = "https://github.com/ompl/ompl/commit/d4e26fc3d86cae0c36941a10bf0307e02526db44.patch";
hash = "sha256-sAQLrWHoR/DhHk8TtUEy8E8VXqrvtXl2BGS5UvElJl8=";
})
];
});
plotjuggler = (rosSuper.plotjuggler.override {
# plotjuggler is not yet compatible with newer versions
protobuf = self.protobuf_23;
}).overrideAttrs ({
2021-03-06 15:39:06 -05:00
nativeBuildInputs ? [], ...
}: {
dontWrapQtApps = false;
2021-03-06 15:39:06 -05:00
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
Wrap plotjuggler with Qt wrapper Without this, running `ros2 run plotjuggler plotjuggler` results in: qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Stack trace (most recent call last): #13 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in #12 Object "/nix/store/g7mcg164p44hzgra9sp653a34d276vw2-ros-humble-plotjuggler-3.7.1-r1/lib/plotjuggler/plotjuggler", at 0x473b04, in #11 Object "/nix/store/1x4ijm9r1a88qk7zcmbbfza324gx1aac-glibc-2.37-8/lib/libc.so.6", at 0x7f512523db88, in __libc_start_main #10 Object "/nix/store/1x4ijm9r1a88qk7zcmbbfza324gx1aac-glibc-2.37-8/lib/libc.so.6", at 0x7f512523dacd, in #9 Object "/nix/store/g7mcg164p44hzgra9sp653a34d276vw2-ros-humble-plotjuggler-3.7.1-r1/lib/plotjuggler/plotjuggler", at 0x4711af, in #8 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Widgets.so.5", at 0x7f51263765b8, in QApplicationPrivate::init() #7 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Gui.so.5", at 0x7f5125b29cdb, in QGuiApplicationPrivate::init() #6 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Core.so.5", at 0x7f51256d13b4, in QCoreApplicationPrivate::init() #5 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Gui.so.5", at 0x7f5125b26e3f, in QGuiApplicationPrivate::createEventDispatcher() #4 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Gui.so.5", at 0x7f5125b2686a, in QGuiApplicationPrivate::createPlatformIntegration() #3 Object "/nix/store/b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9/lib/libQt5Core.so.5", at 0x7f5125499cc0, in QMessageLogger::fatal(char const*, ...) const #2 Object "/nix/store/1x4ijm9r1a88qk7zcmbbfza324gx1aac-glibc-2.37-8/lib/libc.so.6", at 0x7f512523c8b9, in abort #1 Object "/nix/store/1x4ijm9r1a88qk7zcmbbfza324gx1aac-glibc-2.37-8/lib/libc.so.6", at 0x7f5125252c85, in gsignal #0 Object "/nix/store/1x4ijm9r1a88qk7zcmbbfza324gx1aac-glibc-2.37-8/lib/libc.so.6", at 0x7f51252a1a8c, in Aborted (Signal sent by tkill() 2090297 1000)
2023-09-05 23:07:24 +02:00
postFixup = ''
wrapQtApp "$out/lib/plotjuggler/plotjuggler"
'';
2021-03-06 15:39:06 -05:00
});
python-qt-binding = (rosSuper.python-qt-binding.override {
python3Packages = rosSelf.python3Packages.overrideScope (pyFinal: pyPrev: {
pyqt5 = pyPrev.pyqt5.overrideAttrs ({
patches ? [], ...
}: {
patches = patches ++ [ (self.fetchpatch {
url = "https://aur.archlinux.org/cgit/aur.git/plain/restore-sip4-support.patch?h=python-pyqt5-sip4&id=6e712e6c588d550a1a6f83c1b37c2c9135aae6ba";
hash = "sha256-NfMe/EK1Uj88S82xZSm+A6js3PK9mlgsaci/kinlsy8=";
}) ];
});
});
}).overrideAttrs ({
propagatedBuildInputs ? [], ...
}: {
propagatedBuildInputs = propagatedBuildInputs ++ (with rosSelf.pythonPackages; [
pyside2
sip4
]);
2019-04-06 16:26:04 -04:00
dontWrapQtApps = true;
setupHook = self.writeText "python-qt-binding-setup-hook" ''
_pythonQtBindingPreFixupHook() {
# Prevent /build RPATH references
rm -rf devel/lib
}
preFixupHooks+=(_pythonQtBindingPreFixupHook)
'';
postPatch = ''
sed -e "1 i\\import PyQt5" \
-e "s#sipconfig\._pkg_config\['default_mod_dir'\], 'PyQt5'#PyQt5.__path__[0]#" \
-e "s#with open(os.path.join(tmpdirname, 'QtCore', 'QtCoremod.sip'), 'w') as outfp:##" \
-e "s#outfp.write(output)##" \
-i cmake/sip_configure.py
'';
2019-12-03 11:05:13 -05:00
});
2023-01-12 12:27:27 +01:00
rqt-console = rosSuper.rqt-console.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_console/rqt_console"
2023-01-12 12:27:27 +01:00
'';
});
2021-11-24 15:55:11 -05:00
rqt-graph = rosSuper.rqt-graph.overrideAttrs ({
2021-11-25 13:00:06 -05:00
nativeBuildInputs ? [], postFixup ? "", ...
}: {
dontWrapQtApps = false;
2020-03-04 17:37:15 -05:00
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
2021-11-25 13:00:06 -05:00
postFixup = postFixup + ''
wrapQtApp "$out/bin/rqt_graph"
wrapQtApp "$out/lib/rqt_graph/rqt_graph"
2020-07-11 15:46:18 -04:00
'';
});
2021-11-24 15:55:11 -05:00
rqt-gui = rosSuper.rqt-gui.overrideAttrs ({
2021-11-25 13:00:06 -05:00
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
2021-11-25 13:00:06 -05:00
postFixup = postFixup + ''
2021-11-24 15:55:11 -05:00
wrapQtApp "$out/bin/rqt"
wrapQtApp "$out/lib/rqt_gui/rqt_gui"
2021-11-17 20:35:53 -05:00
'';
});
2022-05-07 13:46:39 -04:00
rqt-image-view = rosSuper.rqt-image-view.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
2022-05-07 17:59:54 -04:00
wrapQtApp "$out/lib/rqt_image_view/rqt_image_view"
2022-05-07 13:46:39 -04:00
'';
});
2021-11-17 20:35:53 -05:00
rqt-msg = rosSuper.rqt-msg.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_msg/rqt_msg"
'';
2021-11-17 20:35:53 -05:00
});
rqt-plot = rosSuper.rqt-plot.overrideAttrs ({
2021-11-25 13:00:06 -05:00
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
2021-11-25 13:00:06 -05:00
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_plot/rqt_plot"
2021-11-17 20:35:53 -05:00
'';
});
2021-11-17 20:35:53 -05:00
rqt-publisher = rosSuper.rqt-publisher.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_publisher/rqt_publisher"
'';
2021-11-17 20:35:53 -05:00
});
rqt-py-console = rosSuper.rqt-py-console.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_py_console/rqt_py_console"
'';
2021-11-17 20:35:53 -05:00
});
rqt-reconfigure = rosSuper.rqt-reconfigure.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_reconfigure/rqt_reconfigure"
'';
});
rqt-robot-monitor = rosSuper.rqt-robot-monitor.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_robot_monitor/rqt_robot_monitor"
'';
2021-11-17 20:35:53 -05:00
});
rqt-service-caller = rosSuper.rqt-service-caller.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_service_caller/rqt_service_caller"
'';
2021-11-17 20:35:53 -05:00
});
rqt-shell = rosSuper.rqt-shell.overrideAttrs ({
2021-11-25 13:00:06 -05:00
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
2021-11-25 13:00:06 -05:00
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_shell/rqt_shell"
2021-11-17 20:35:53 -05:00
'';
});
rqt-srv = rosSuper.rqt-srv.overrideAttrs ({
2021-11-25 13:00:06 -05:00
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_srv/rqt_srv"
'';
2021-11-17 20:35:53 -05:00
});
rqt-topic = rosSuper.rqt-topic.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
2021-11-17 20:35:53 -05:00
}: {
dontWrapQtApps = false;
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = postFixup + ''
wrapQtApp "$out/lib/rqt_topic/rqt_topic"
'';
2021-11-17 20:35:53 -05:00
});
2021-03-06 13:20:00 -05:00
turtlesim = rosSuper.turtlesim.overrideAttrs ({
nativeBuildInputs ? [], ...
}: {
dontWrapQtApps = false;
2021-03-06 13:20:00 -05:00
nativeBuildInputs = nativeBuildInputs ++ [ self.qt5.wrapQtAppsHook ];
postFixup = ''
wrapQtApp "$out/lib/turtlesim/turtlesim_node"
'';
});
} // (mrptOverrides rosSelf rosSuper);
2022-09-21 19:41:50 -04:00
otherSplices = {
selfBuildBuild = self.pkgsBuildBuild.rosPackages.${distro};
selfBuildHost = self.pkgsBuildHost.rosPackages.${distro};
selfBuildTarget = self.pkgsBuildTarget.rosPackages.${distro};
selfHostHost = self.pkgsHostHost.rosPackages.${distro};
selfTargetTarget = self.pkgsTargetTarget.rosPackages.${distro} or {};
};
keep = rosSelf: {
inherit (rosSelf) lib buildRosPackage;
};
in self.lib.makeScopeWithSplicing
self.splicePackages
self.newScope
otherSplices
keep
(_: {})
2022-11-05 17:46:30 -04:00
(rosSelf: self.lib.composeManyExtensions ([
2022-09-21 19:41:50 -04:00
base
(import (./. + "/${distro}/generated.nix"))
overrides
2022-11-05 17:46:30 -04:00
]
++ self.lib.optional (version == 1) (import ./ros1-overlay.nix self)
++ self.lib.optional (version == 2) (import ./ros2-overlay.nix self)
++ [
2022-09-21 19:41:50 -04:00
(import (./. + "/${distro}/overrides.nix") self)
2022-11-05 17:46:30 -04:00
]) rosSelf {})