nix-ros-overlay/distro-overlay.nix

261 lines
8.4 KiB
Nix
Raw Normal View History

{ distro, python }:
2019-04-16 15:02:56 -04:00
self: super:
with self.lib;
with import ./mk-overlay.nix { inherit (self) lib; };
let
base = rosSelf: rosSuper: {
callPackage = self.newScope rosSelf;
buildRosPackage = rosSelf.callPackage ./build-ros-package { };
buildEnv = rosSelf.callPackage ./build-env {
inherit (self) buildEnv;
};
inherit python;
pythonPackages = rosSelf.python.pkgs;
boost = self.boost.override {
python = rosSelf.python;
enablePython = true;
};
};
overrides = rosSelf: rosSuper: let
patchBoostPython = let
pythonVersion = rosSelf.python.sourceVersion;
pythonLib = "python${pythonVersion.major}${pythonVersion.minor}";
in ''
sed -Ei CMakeLists.txt \
-e 's/(Boost [^)]*)python[^ )]*([ )])/\1${pythonLib}\2/'
'';
patchVendorUrl = pkg: args: pkg.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = ''
2019-09-06 00:44:00 -04:00
substituteInPlace CMakeLists.txt \
--replace '${args.url}' '${self.fetchurl args}'
'' + postPatch;
});
in {
# ROS package overrides/fixups
ament-cmake-core = rosSuper.ament-cmake-core.overrideAttrs ({
propagatedBuildInputs ? [], ...
}: {
propagatedBuildInputs = [ self.cmake rosSelf.ament-package ] ++ propagatedBuildInputs;
setupHook = ./ament-cmake-core-setup-hook.sh;
});
2019-04-08 17:28:23 -04:00
camera-calibration-parsers = rosSuper.camera-calibration-parsers.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = postPatch + patchBoostPython;
});
2019-04-08 17:28:23 -04:00
catkin = rosSuper.catkin.overrideAttrs ({
2019-05-12 19:37:25 -04:00
propagatedBuildInputs ? [],
2019-04-08 12:36:05 -04:00
prePhases ? [],
postPatch ? "", ...
}: let
setupHook = self.callPackage ./catkin-setup-hook { } distro;
in {
2019-05-12 19:37:25 -04:00
propagatedBuildInputs = [ self.cmake ] ++ propagatedBuildInputs;
2019-04-08 12:36:05 -04:00
prePhases = prePhases ++ [ "setupPhase" ];
# Catkin uses its own setup hook
setupPhase = ''
source "${setupHook}"
'';
postPatch = postPatch + ''
patchShebangs cmake
substituteInPlace cmake/templates/python_distutils_install.sh.in \
--replace /usr/bin/env "${self.coreutils}/bin/env"
'';
inherit setupHook;
});
2019-04-08 12:36:05 -04:00
# Packages that depend on catkin-pip still fail because they try to
# download from the internet, but it should work outside of Nix builds.
2019-04-08 17:28:23 -04:00
catkin-pip = rosSuper.catkin-pip.overrideAttrs ({
2019-04-08 12:36:05 -04:00
postPatch ? "", ...
}: {
postPatch = postPatch + ''
patchShebangs cmake
substituteInPlace cmake/scripts/path_prepend.sh \
--replace /bin/sed "${self.gnused}/bin/sed"
substituteInPlace cmake/catkin-pip-prefix.cmake.in \
--replace NO_SYSTEM_ENVIRONMENT_PATH ""
'';
});
2019-04-08 17:28:23 -04:00
cv-bridge = rosSuper.cv-bridge.overrideAttrs ({
postPatch ? "",
propagatedBuildInputs ? [], ...
}: {
postPatch = postPatch + patchBoostPython;
propagatedBuildInputs = propagatedBuildInputs ++ [ rosSelf.pythonPackages.opencv3 ];
});
2019-04-08 17:28:23 -04:00
dynamic-reconfigure = rosSuper.dynamic-reconfigure.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = postPatch + ''
substituteInPlace cmake/setup_custom_pythonpath.sh.in \
--replace '#!/usr/bin/env sh' '#!${self.stdenv.shell}'
'';
});
2019-09-06 00:44:00 -04:00
fmilibrary-vendor = patchVendorUrl rosSuper.fmilibrary-vendor {
url = "https://jmodelica.org/fmil/FMILibrary-2.0.3-src.zip";
sha256 = "16lx6355zskrb7wgw2bzdzms36pcjyl2ry03wgsac5215jg1zhjc";
};
2019-05-12 19:09:30 -04:00
gazebo-plugins = rosSuper.gazebo-plugins.overrideAttrs ({
patches ? [], ...
}:{
patches = patches ++ [
(self.fetchpatch {
url = "https://github.com/ros-simulation/gazebo_ros_pkgs/commit/b756d784d4bdc45bf33b28ac6c0a01c15563e36c.patch";
2019-05-12 19:09:30 -04:00
sha256 = "08lpkcda9yr3vjc2wxy5hzm99g7876d6402snac3mx5j7fa3w5i2";
stripLen = 1;
})
];
});
gazebo-ros = rosSuper.gazebo-ros.overrideAttrs ({ ... }:{
setupHook = ./gazebo-ros-setup-hook.sh;
});
libyaml-vendor = patchVendorUrl rosSuper.libyaml-vendor {
url = "https://github.com/yaml/libyaml/archive/10c907871f1ccd779c7fccf6b81a62762b5c4e7b.zip";
sha256 = "0v6ks4hpxmakgymcfvafynla76gl3866grgwf4vjdsb4rsvr13vx";
};
2019-04-08 17:28:23 -04:00
map-server = rosSuper.map-server.overrideAttrs ({
nativeBuildInputs ? [], ...
}: {
nativeBuildInputs = nativeBuildInputs ++ [ self.pkgconfig ];
});
2019-04-18 01:55:44 -04:00
message-relay = rosSuper.message-relay.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = postPatch + ''
patchShebangs scripts
'';
});
2019-04-08 17:28:23 -04:00
python-qt-binding = rosSuper.python-qt-binding.overrideAttrs ({
2019-04-06 16:26:04 -04:00
propagatedNativeBuildInputs ? [],
postPatch ? "", ...
}: {
2019-04-06 16:26:04 -04:00
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++ [ rosSelf.pythonPackages.sip ];
postPatch = ''
sed -e "s#'-I', sip_dir,#'-I', '${rosSelf.pythonPackages.pyqt5}/share/sip/PyQt5',#" \
-e "s#qtconfig\['QT_INSTALL_HEADERS'\]#'${self.qt5.qtbase.dev}/include'#g" \
-i cmake/sip_configure.py
'' + postPatch;
2019-04-06 16:26:04 -04:00
setupHook = self.writeText "python-qt-binding-setup-hook" ''
_pythonQtBindingPreFixupHook() {
# Prevent /build RPATH references
rm -rf devel/lib
}
preFixupHooks+=(_pythonQtBindingPreFixupHook)
'';
});
rosidl-default-runtime = rosSuper.rosidl-default-runtime.overrideAttrs ({
propagatedBuildInputs ? [], ...
}: {
propagatedBuildInputs = [ rosSelf.rmw-fastrtps-cpp ] ++ propagatedBuildInputs;
});
rosidl-generator-py = rosSuper.rosidl-generator-py.overrideAttrs ({
patches ? [], ...
}: {
patches = patches ++ [
(self.fetchpatch {
url = "https://github.com/ros2/rosidl_python/commit/a7ce53c8922963439ba526f7f6c92dc0cc955c5f.patch";
sha256 = "0yal5mvhwxwkwzv5rlssfc4czck8zmcm36kwssypfwbkggc2700f";
stripLen = 1;
})
];
});
2019-09-06 00:44:00 -04:00
rqt-gui = rosSuper.rqt-gui.overrideAttrs ({
2019-04-06 16:26:04 -04:00
nativeBuildInputs ? [],
postFixup ? "", ...
}: {
2019-04-06 16:26:04 -04:00
nativeBuildInputs = nativeBuildInputs ++ [ self.makeWrapper ];
2019-04-06 16:26:04 -04:00
postFixup = ''
2019-09-06 00:44:00 -04:00
wrapProgram $out/bin/rqt \
2019-04-06 16:26:04 -04:00
--prefix QT_PLUGIN_PATH : "${self.qt5.qtbase.bin}/${self.qt5.qtbase.qtPluginPrefix}"
'' + postFixup;
});
2019-09-06 00:44:00 -04:00
rviz = rosSuper.rviz.overrideAttrs ({
nativeBuildInputs ? [],
postFixup ? "", ...
}: {
nativeBuildInputs = nativeBuildInputs ++ [ self.makeWrapper ];
postFixup = ''
2019-09-06 00:44:00 -04:00
wrapProgram $out/bin/rviz \
2019-04-06 16:26:04 -04:00
--prefix QT_PLUGIN_PATH : "${self.qt5.qtbase.bin}/${self.qt5.qtbase.qtPluginPrefix}"
'' + postFixup;
});
2019-09-06 00:44:00 -04:00
rviz-ogre-vendor = (patchVendorUrl rosSuper.rviz-ogre-vendor {
url = "https://github.com/OGRECave/ogre/archive/v1.10.12.zip";
sha256 = "1nafqazv396y97z0rgrn0dmkddq7y4zgfszvmi3aw6hr6zwyrpa3";
}).overrideAttrs ({
preFixup ? "", ...
}: {
dontFixCmake = true;
# Prevent RPATH reference to build directory
preFixup = ''
rm -r ogre_install
'' + preFixup;
});
shared-queues-vendor = patchVendorUrl (patchVendorUrl rosSuper.shared-queues-vendor {
url = "https://github.com/cameron314/concurrentqueue/archive/8f65a8734d77c3cc00d74c0532efca872931d3ce.zip";
sha256 = "0cmsmgc87ndd9hiv187xkvjkn8fipn3hsijjc864h2lfcyigbxq1";
}) {
url = "https://github.com/cameron314/readerwriterqueue/archive/ef7dfbf553288064347d51b8ac335f1ca489032a.zip";
sha256 = "1255n51y1bjry97n4w60mgz6b9h14flfrxb01ihjf6pwvvfns8ag";
};
tinydir-vendor = patchVendorUrl rosSuper.tinydir-vendor {
url = "https://github.com/cxong/tinydir/archive/1.2.4.tar.gz";
sha256 = "1qjwky7v4b9d9dmxzsybnhiz6xgx94grc67sdyvlp1d4kfkfsl4w";
};
uncrustify-vendor = patchVendorUrl rosSuper.uncrustify-vendor {
url = "https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz";
sha256 = "04ndwhcn9iv3cy4p5wgh5z0vx2sywqlydyympn9m3h5458w1aijh";
};
2019-04-08 17:28:23 -04:00
urdf = rosSuper.urdf.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = postPatch + patchBoostPython;
});
yaml-cpp-vendor = patchVendorUrl rosSuper.yaml-cpp-vendor {
url = "https://github.com/jbeder/yaml-cpp/archive/0f9a586ca1dc29c2ecb8dd715a315b93e3f40f79.zip";
sha256 = "1g45f71mk4gyca550177qf70v5cvavlsalmg7x8bi59j6z6f0mgz";
};
};
in mkOverlay [
base
(import (./. + "/${distro}/generated.nix"))
overrides
(import (./. + "/${distro}/overrides.nix") self)
]