nix-ros-overlay/lib/default.nix
2019-12-06 17:19:28 -05:00

34 lines
882 B
Nix

{ lib ? rosSelf.lib or self.lib
, self ? null
, rosSelf ? null }:
with lib;
{
patchVendorUrl = pkg: {
url, sha256,
originalUrl ? url,
file ? "CMakeLists.txt"
}: pkg.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = ''
substituteInPlace '${file}' \
--replace '${originalUrl}' '${self.fetchurl { inherit url sha256; }}'
'' + postPatch;
});
patchBoostPython = let
pythonVersion = rosSelf.python.sourceVersion;
pythonLib = "python${pythonVersion.major}${pythonVersion.minor}";
in ''
sed -Ei CMakeLists.txt \
-e 's/(Boost [^)]*)python[^ )]*([ )])/\1${pythonLib}\2/'
'';
patchBoostSignals = pkg: pkg.overrideAttrs ({
postPatch ? "", ...
}: {
postPatch = ''
sed -i '/find_package(Boost [^)]*/s/signals//g' CMakeLists.txt
'' + postPatch;
});
} // (import ./mk-overlay.nix { inherit lib; })