Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a6377eb
[jazzy] zenoh-cpp-vendor WIP
muellerbernd Jan 10, 2025
259f44f
[jazzy] zenoh-cpp-vendor: add cargoDeps WIP
muellerbernd Jan 10, 2025
2fe8f33
[change] jazzy: overrides for zenoh-cpp-vendor
muellerbernd Feb 15, 2025
b0e9025
[fix] humble: zenoh-cpp-vendor
muellerbernd Feb 15, 2025
182b71c
[change] jazzy: overrides, remove comment line
muellerbernd Feb 15, 2025
4923a59
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Feb 17, 2025
0f775c2
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Feb 18, 2025
59320dc
[change] humble: overrides for zenoh-bridge-dds still WIP
muellerbernd Feb 18, 2025
e7ff83f
[change] cleanup CFLAGS for zenoh-bridge-dds
muellerbernd Feb 18, 2025
a731feb
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Feb 20, 2025
690cb91
[refactor] move zenoh-cpp-vendor overrides to ros2-overlay.nix
muellerbernd Feb 20, 2025
2959556
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Feb 27, 2025
2b1a9d0
[fix] zenoh-cpp-vendor for humble, jazzy and rolling
muellerbernd Feb 27, 2025
aabf0bc
[fix] zenoh-cpp-vendor for humble, jazzy and rolling, now with versio…
muellerbernd Feb 27, 2025
df1f744
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Mar 2, 2025
363788f
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Apr 7, 2025
1f0ed4c
[update][jazzy] zenoh-cpp-vendor
muellerbernd Apr 7, 2025
50493ea
[update][rolling] zenoh-cpp-vendor
muellerbernd Apr 7, 2025
8ba64dc
Merge branch 'lopsided98:develop' into fix-zenoh
muellerbernd Apr 15, 2025
62dafbd
[change] add patchAmentVendorGitZenoh function for patching zenoh Cma…
muellerbernd Apr 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions distros/humble/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,80 @@ in with lib; {
})
];
});

zenoh-bridge-dds = rosSuper.zenoh-bridge-dds.overrideAttrs ({
nativeBuildInputs ? [], pname ? "", postPatch ? "", src ? "", version ? "", ...
}: {
nativeBuildInputs = nativeBuildInputs ++ [
self.rustPlatform.cargoSetupHook
self.cargo
self.rustc
];
postPatch = postPatch + ''
ln -s zenoh-bridge-dds/Cargo.lock Cargo.lock
'';
cargoDeps = self.rustPlatform.fetchCargoVendor {
inherit pname version src;
hash = "sha256-DRMuF6DNLbMIA1CmhVZ7L//EuTCQNL5/lU6d+3DKnO4=";
prePatch = ''
cd zenoh-bridge-dds
'';
};
env.LIBCLANG_PATH = "${lib.getLib self.llvmPackages.libclang}/lib";
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-conversion"
];
});

zenoh-cpp-vendor = let
zenoh-c-url = "https://github.com/eclipse-zenoh/zenoh-c.git";
zenoh-c-rev = "5fce7fb1d397e016ad02a50bde4262007d755424";
zenoh-c-hash = "sha256-jayvCq4xvvAheeSpmxwg1VA3TLPyS4QGdVhte8wk0KA=";
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "bd4d741c6c4fa6509d8d745e22c3c50b4306bd65";
zenoh-cpp-hash = "sha256-OLNlew4pOLl1PRWrJTTfDv7LGYHGX0A7A4RW9jwCOsE=";
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;
}) {
url = zenoh-c-url;
rev = zenoh-c-rev;
fetchgitArgs.hash = zenoh-c-hash;
}).overrideAttrs ({
nativeBuildInputs ? [], postPatch ? "", ...
}: let
zenoh-c-source = self.fetchFromGitHub {
owner = "eclipse-zenoh";
repo = "zenoh-c";
rev = zenoh-c-rev;
hash = zenoh-c-hash;
};
in {
nativeBuildInputs = nativeBuildInputs ++ [
self.rustPlatform.cargoSetupHook
self.cargo
self.rustc
];
postPatch = postPatch + ''
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this currently works for me but to get it to cross-compile you need to set the define ZENOHC_CUSTOM_TARGET in the cmake flags. Something like this:

cmakeFlags = cmakeFlags ++
      lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform)
        [ "-DZENOHC_CUSTOM_TARGET=${stdenv.hostPlatform.config}" ];

See: https://github.com/eclipse-zenoh/zenoh-c?tab=readme-ov-file#cross-compilation

ln -s ${zenoh-c-source.outPath}/Cargo.lock Cargo.lock
echo "set(ZENOH-C-VENDOR $(awk '/ament_vendor\(zenoh_c_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt
echo "set(ZENOH-CPP-VENDOR $(awk '/ament_vendor\(zenoh_cpp_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt

cat >> CMakeLists.txt <<'EOF'
if(NOT ''${ZENOH-CPP-VENDOR} STREQUAL "${zenoh-cpp-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_cpp_vendor (Nix: ${zenoh-cpp-rev}, upstream: ''${ZENOH-CPP-VENDOR}) Fix this in overrides.nix.")
endif()
if(NOT ''${ZENOH-C-VENDOR} STREQUAL "${zenoh-c-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_c_vendor (Nix: ${zenoh-c-rev}, upstream: ''${ZENOH-C-VENDOR}) Fix this in overrides.nix.")
endif()
EOF
'';
cargoDeps = self.rustPlatform.importCargoLock {
lockFile = "${zenoh-c-source.outPath}/Cargo.lock";
outputHashes = {
"zenoh-1.2.0" = "sha256-0E03X0ZjZNJr7FgqnbjXCM6gKKezSSFSC0HfAq7WhM4=";
};
};
});
}
76 changes: 76 additions & 0 deletions distros/jazzy/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,80 @@ in {
})
];
});

zenoh-bridge-dds = rosSuper.zenoh-bridge-dds.overrideAttrs ({
nativeBuildInputs ? [], pname ? "", postPatch ? "", src ? "", version ? "", ...
}: {
nativeBuildInputs = nativeBuildInputs ++ [
self.rustPlatform.cargoSetupHook
self.cargo
self.rustc
];
postPatch = postPatch + ''
ln -s zenoh-bridge-dds/Cargo.lock Cargo.lock
'';
cargoDeps = self.rustPlatform.fetchCargoVendor {
inherit pname version src;
hash = "sha256-DRMuF6DNLbMIA1CmhVZ7L//EuTCQNL5/lU6d+3DKnO4=";
prePatch = ''
cd zenoh-bridge-dds
'';
};
env.LIBCLANG_PATH = "${lib.getLib self.llvmPackages.libclang}/lib";
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-conversion"
];
});

zenoh-cpp-vendor = let
zenoh-c-url = "https://github.com/eclipse-zenoh/zenoh-c.git";
zenoh-c-rev = "e6a1971139f405f7887bf5bb54f0efe402123032";
zenoh-c-hash = "sha256-eJbnb1UJbtuYb+dSpKqVgI1p/97bSc+KTcbO1GNg9jU=";
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "8ad67f6c7a9031acd437c8739bbc8ddab0ca8173";
zenoh-cpp-hash = "sha256-0iRhmMtrhDdM7X0ByiICT4s7lDFcGLSR1dEImzT1mWs=";
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;
}) {
url = zenoh-c-url;
rev = zenoh-c-rev;
fetchgitArgs.hash = zenoh-c-hash;
}).overrideAttrs ({
nativeBuildInputs ? [], postPatch ? "", ...
}: let
zenoh-c-source = self.fetchFromGitHub {
owner = "eclipse-zenoh";
repo = "zenoh-c";
rev = zenoh-c-rev;
hash = zenoh-c-hash;
};
in {
nativeBuildInputs = nativeBuildInputs ++ [
self.rustPlatform.cargoSetupHook
self.cargo
self.rustc
];
postPatch = postPatch + ''
ln -s ${zenoh-c-source.outPath}/Cargo.lock Cargo.lock
echo "set(ZENOH-C-VENDOR $(awk '/ament_vendor\(zenoh_c_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt
echo "set(ZENOH-CPP-VENDOR $(awk '/ament_vendor\(zenoh_cpp_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt

cat >> CMakeLists.txt <<'EOF'
if(NOT ''${ZENOH-CPP-VENDOR} STREQUAL "${zenoh-cpp-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_cpp_vendor (Nix: ${zenoh-cpp-rev}, upstream: ''${ZENOH-CPP-VENDOR}) Fix this in overrides.nix.")
endif()
if(NOT ''${ZENOH-C-VENDOR} STREQUAL "${zenoh-c-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_c_vendor (Nix: ${zenoh-c-rev}, upstream: ''${ZENOH-C-VENDOR}) Fix this in overrides.nix.")
endif()
EOF
'';
cargoDeps = self.rustPlatform.importCargoLock {
lockFile = "${zenoh-c-source.outPath}/Cargo.lock";
outputHashes = {
"zenoh-1.2.1" = "sha256-9oeeiS84Ymyra7yh7+GuocCsXfejlEgbQgKJlig6siY=";
};
};
});
}
52 changes: 52 additions & 0 deletions distros/rolling/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,56 @@ in {
})
];
});

zenoh-cpp-vendor = let
zenoh-c-url = "https://github.com/eclipse-zenoh/zenoh-c.git";
zenoh-c-rev = "e6a1971139f405f7887bf5bb54f0efe402123032";
zenoh-c-hash = "sha256-eJbnb1UJbtuYb+dSpKqVgI1p/97bSc+KTcbO1GNg9jU=";
zenoh-cpp-url = "https://github.com/eclipse-zenoh/zenoh-cpp";
zenoh-cpp-rev = "8ad67f6c7a9031acd437c8739bbc8ddab0ca8173";
zenoh-cpp-hash = "sha256-0iRhmMtrhDdM7X0ByiICT4s7lDFcGLSR1dEImzT1mWs=";
in (lib.patchAmentVendorGitZenoh (lib.patchAmentVendorGitZenoh rosSuper.zenoh-cpp-vendor {
url = zenoh-cpp-url;
rev = zenoh-cpp-rev;
fetchgitArgs.hash = zenoh-cpp-hash;
}) {
url = zenoh-c-url;
rev = zenoh-c-rev;
fetchgitArgs.hash = zenoh-c-hash;
}).overrideAttrs ({
nativeBuildInputs ? [], postPatch ? "", ...
}: let
zenoh-c-source = self.fetchFromGitHub {
owner = "eclipse-zenoh";
repo = "zenoh-c";
rev = zenoh-c-rev;
hash = zenoh-c-hash;
};
in {
nativeBuildInputs = nativeBuildInputs ++ [
self.rustPlatform.cargoSetupHook
self.cargo
self.rustc
];
postPatch = postPatch + ''
ln -s ${zenoh-c-source.outPath}/Cargo.lock Cargo.lock
echo "set(ZENOH-C-VENDOR $(awk '/ament_vendor\(zenoh_c_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt
echo "set(ZENOH-CPP-VENDOR $(awk '/ament_vendor\(zenoh_cpp_vendor/,/VCS_VERSION/ {if (/VCS_VERSION/) print $2}' CMakeLists.txt))" >> CMakeLists.txt

cat >> CMakeLists.txt <<'EOF'
if(NOT ''${ZENOH-CPP-VENDOR} STREQUAL "${zenoh-cpp-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_cpp_vendor (Nix: ${zenoh-cpp-rev}, upstream: ''${ZENOH-CPP-VENDOR}) Fix this in overrides.nix.")
endif()
if(NOT ''${ZENOH-C-VENDOR} STREQUAL "${zenoh-c-rev}")
message(FATAL_ERROR "Mismatch in VCS_VERSION for zenoh_c_vendor (Nix: ${zenoh-c-rev}, upstream: ''${ZENOH-C-VENDOR}) Fix this in overrides.nix.")
endif()
EOF
'';
cargoDeps = self.rustPlatform.importCargoLock {
lockFile = "${zenoh-c-source.outPath}/Cargo.lock";
outputHashes = {
"zenoh-1.2.1" = "sha256-9oeeiS84Ymyra7yh7+GuocCsXfejlEgbQgKJlig6siY=";
};
};
});
}
32 changes: 32 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,38 @@
'' + postPatch;
});

# Patch a vendored download that uses ament_vendor() with a Git repo as the
# source.
# older version only for zenoh because of multiple ament_vendor calls
patchAmentVendorGitZenoh = pkg: {
url,
originalUrl ? url,
rev, # Must correspond to the VCS_VERSION argument
file ? "CMakeLists.txt",
fetchgitArgs ? {},
tarSourceArgs ? {}
}: pkg.overrideAttrs ({
nativeBuildInputs ? [],
postPatch ? "", ...
}: let
# ament_vendor doesn't allow patches for path inputs, so we have to pack it
# into a tar first. Additionally, vcstool only accepts tarballs with the
# version number as the root directory name.
vendor = lib.tarSource tarSourceArgs (self.fetchgit (fetchgitArgs // {
name = rev;
inherit url rev;
}));
in {
# CMake ExternalProject patches are applied with git apply
nativeBuildInputs = nativeBuildInputs ++ [ self.git ];
postPatch = ''
sed -i '\|VCS_URL\s*${originalUrl}|c\
VCS_URL "file://${vendor}"\
VCS_TYPE tar' \
${lib.escapeShellArg file}
'' + postPatch;
});

# Patch a vendored download that uses ament_vendor() with a Git repo as the
# source.
patchAmentVendorGit = pkg: {
Expand Down