Skip to content

gz-tools: init at 2.0.3#432725

Open
Guelakais wants to merge 1 commit into
NixOS:masterfrom
Guelakais:gz-tools
Open

gz-tools: init at 2.0.3#432725
Guelakais wants to merge 1 commit into
NixOS:masterfrom
Guelakais:gz-tools

Conversation

@Guelakais
Copy link
Copy Markdown
Contributor

@Guelakais Guelakais commented Aug 11, 2025

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Aug 11, 2025
@nixpkgs-ci nixpkgs-ci Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 9.needs: reviewer This PR currently has no reviewers requested and needs attention. and removed 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Aug 11, 2025
Copy link
Copy Markdown
Contributor

@yzhou216 yzhou216 left a comment

Choose a reason for hiding this comment

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

$ ./result/bin/gz
I cannot find any available 'gz' command:
	* Did you install any Gazebo library?
	* Did you set the GZ_CONFIG_PATH environment variable?
	    E.g.: export GZ_CONFIG_PATH=$HOME/local/share/gz

I guess GZ_CONFIG_PATH needs to be set?

Comment thread pkgs/by-name/gz/gz-tools/package.nix
Comment thread pkgs/by-name/gz/gz-tools/package.nix
@nixpkgs-ci nixpkgs-ci Bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Aug 11, 2025
@Guelakais
Copy link
Copy Markdown
Contributor Author

$ ./result/bin/gz
I cannot find any available 'gz' command:
	* Did you install any Gazebo library?
	* Did you set the GZ_CONFIG_PATH environment variable?
	    E.g.: export GZ_CONFIG_PATH=$HOME/local/share/gz

I guess GZ_CONFIG_PATH needs to be set?

gc does have a cli tool? I only build them as librarys

@nixpkgs-ci nixpkgs-ci Bot added the 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. label Aug 11, 2025
@yzhou216
Copy link
Copy Markdown
Contributor

$ ./result/bin/gz
I cannot find any available 'gz' command:
	* Did you install any Gazebo library?
	* Did you set the GZ_CONFIG_PATH environment variable?
	    E.g.: export GZ_CONFIG_PATH=$HOME/local/share/gz

I guess GZ_CONFIG_PATH needs to be set?

gc does have a cli tool? I only build them as librarys

Yes. That's why I used makeWrapper to inject ruby into PATH.

@Guelakais
Copy link
Copy Markdown
Contributor Author

$ ./result/bin/gz
I cannot find any available 'gz' command:
	* Did you install any Gazebo library?
	* Did you set the GZ_CONFIG_PATH environment variable?
	    E.g.: export GZ_CONFIG_PATH=$HOME/local/share/gz

I guess GZ_CONFIG_PATH needs to be set?

gc does have a cli tool? I only build them as librarys

Yes. That's why I used makeWrapper to inject ruby into PATH.

Currently all gc packages are built as librarys. They aren't usable as cli tool.

@yzhou216
Copy link
Copy Markdown
Contributor

$ ./result/bin/gz
I cannot find any available 'gz' command:
	* Did you install any Gazebo library?
	* Did you set the GZ_CONFIG_PATH environment variable?
	    E.g.: export GZ_CONFIG_PATH=$HOME/local/share/gz

I guess GZ_CONFIG_PATH needs to be set?

gc does have a cli tool? I only build them as librarys

Yes. That's why I used makeWrapper to inject ruby into PATH.

Currently all gc packages are built as librarys. They aren't usable as cli tool.

Then you should probably remove the executable in $out/bin in postInstall.

@Guelakais
Copy link
Copy Markdown
Contributor Author

Then you should probably remove the executable in $out/bin in postInstall.

Then my next PR will be to activate the gz-cmake cli capabilities.

Comment thread pkgs/by-name/gz/gz-tools/package.nix
Comment thread pkgs/by-name/gz/gz-tools/package.nix Outdated
Comment thread pkgs/by-name/gz/gz-tools/package.nix
@yzhou216

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@yzhou216 yzhou216 left a comment

Choose a reason for hiding this comment

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

You might want to mark x86_64-darwin as badPlatform. Other than that, it looks good. Please squash the last commit when you get a chance.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Aug 11, 2025
@Guelakais
Copy link
Copy Markdown
Contributor Author

I've just tried rebasing the gz-tools branch over the gz-make branch using the activate CLI tool, and it works too.

@yzhou216
Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 432725

Logs: https://github.com/yzhou216/nixpkgs-review-gha/actions/runs/16884488306


x86_64-linux

✅ 1 package built:
  • gz-tools

aarch64-linux

✅ 1 package built:
  • gz-tools

x86_64-darwin (sandbox = true)

❌ 1 package failed to build:
  • gz-tools

aarch64-darwin (sandbox = true)

✅ 1 package built:
  • gz-tools

@Guelakais
Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 432725

Logs: https://github.com/yzhou216/nixpkgs-review-gha/actions/runs/16884488306

x86_64-linux

✅ 1 package built:

aarch64-linux

✅ 1 package built:

x86_64-darwin (sandbox = true)

❌ 1 package failed to build:

aarch64-darwin (sandbox = true)

✅ 1 package built:

What did has failed, in particular? I can't reproduce your failure and would like to solve the bug.

@yzhou216
Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review-gha
Command: nixpkgs-review pr 432725
Logs: https://github.com/yzhou216/nixpkgs-review-gha/actions/runs/16884488306

x86_64-linux

✅ 1 package built:

aarch64-linux

✅ 1 package built:

x86_64-darwin (sandbox = true)

❌ 1 package failed to build:

aarch64-darwin (sandbox = true)

✅ 1 package built:

What did has failed, in particular? I can't reproduce your failure and would like to solve the bug.

https://github.com/yzhou216/nixpkgs-review-gha/actions/runs/16884488306/job/47828535150#step:6:611

@Guelakais
Copy link
Copy Markdown
Contributor Author

I think, I see, what's the error is. The current gz-cmake package didn't has cppcheck. So my current plan is to add this to gz-make, rebase the commits here on to the updated gz-make branch and look if it works.

@nixpkgs-ci nixpkgs-ci Bot removed the 8.has: module (update) This PR changes an existing module in `nixos/` label Aug 12, 2025
@Guelakais
Copy link
Copy Markdown
Contributor Author

Then you should probably remove the executable in $out/bin in postInstall.

Then my next PR will be to activate the gz-cmake cli capabilities.

Maybe, gz-cmake doesn't provide a mainprogram?

error: builder for '/nix/store/kmzbxb1y1vympkhg6hqaxzbm7py3nr7y-gz-cmake-4.2.0.drv' failed with exit code 2;
       last 25 log lines:
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/GzSanitizers.cmake
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/GzSetCompilerFlags.cmake
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/GzStringAppend.cmake
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/GzUtils.cmake
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/JoinPaths.cmake
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/Export.hh.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/cmake_uninstall.cmake.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/cpack_options.cmake.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/gz-all-config.cmake.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/gz-component-config.cmake.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/gz-config.cmake.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/gz_auto_headers.hh.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/upload_doc.sh.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/version_info.json.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/pkgconfig/gz-component.pc.in
       > -- Installing: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/cmake/gz-cmake4/cmake4/pkgconfig/gz.pc.in
       > Running phase: fixupPhase
       > shrinking RPATHs of ELF executables and libraries in /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0
       > checking for references to /build/ in /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0...
       > patching script interpreter paths in /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0
       > /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/share/gz/gz-cmake4/tools/doc_check.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/gkwbw9nzbkbz298njbn3577zmrnglbbi-bash-5.3p0/bin/sh"
       > stripping (with command strip and flags -S -p) in  /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/lib
       > Running phase: installCheckPhase
       > Executing versionCheckPhase
       > versionCheckHook: /nix/store/w635qr3zqsmkjrg5lbnq3maw87zfn04y-gz-cmake-4.2.0/bin/gz was not found, or is not an executable
       For full logs, run:
         nix log /nix/store/kmzbxb1y1vympkhg6hqaxzbm7py3nr7y-gz-cmake-4.2.0.drv

@yzhou216
Copy link
Copy Markdown
Contributor

yzhou216 commented Aug 13, 2025

Maybe, gz-cmake doesn't provide a mainprogram?

I don't think it does.

https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/gz/gz-cmake/package.nix#L53

@yzhou216
Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 432725

Logs: https://github.com/yzhou216/nixpkgs-review-gha/actions/runs/16935216414


x86_64-linux

✅ 4 packages built:
  • gz-cmake
  • gz-tools
  • gz-utils
  • gz-utils.doc

aarch64-linux

✅ 4 packages built:
  • gz-cmake
  • gz-tools
  • gz-utils
  • gz-utils.doc

x86_64-darwin (sandbox = true)

❌ 4 packages failed to build:
  • gz-cmake
  • gz-tools
  • gz-utils
  • gz-utils.doc

Error logs: `x86_64-darwin`
gz-cmake
-- Found Python3: /nix/store/9zzyv1p496m8b7j8v3y2dqq1xii9anx5-python3-3.13.5/bin/python3.13 (found version "3.13.5") found components: Interpreter
-- Adding codecheck target
-- Build configuration successful
-- Configuring incomplete, errors occurred!
make[2]: *** [examples/CMakeFiles/gz_conf_RWD.dir/build.make:102: examples/gz_conf_RWD-prefix/src/gz_conf_RWD-stamp/gz_conf_RWD-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1591: examples/CMakeFiles/gz_conf_RWD.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
-- Found Python3: /nix/store/9zzyv1p496m8b7j8v3y2dqq1xii9anx5-python3-3.13.5/bin/python3.13 (found version "3.13.5") found components: Interpreter
-- Adding codecheck target
-- Build configuration successful
-- Configuring incomplete, errors occurred!
make[2]: *** [examples/CMakeFiles/gz_conf_D.dir/build.make:102: examples/gz_conf_D-prefix/src/gz_conf_D-stamp/gz_conf_D-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1623: examples/CMakeFiles/gz_conf_D.dir/all] Error 2
-- Found Python3: /nix/store/9zzyv1p496m8b7j8v3y2dqq1xii9anx5-python3-3.13.5/bin/python3.13 (found version "3.13.5") found components: Interpreter
-- Adding codecheck target
-- Build configuration successful
-- Configuring incomplete, errors occurred!
make[2]: *** [examples/CMakeFiles/gz_conf_R.dir/build.make:102: examples/gz_conf_R-prefix/src/gz_conf_R-stamp/gz_conf_R-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1559: examples/CMakeFiles/gz_conf_R.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

aarch64-darwin (sandbox = true)

✅ 4 packages built:
  • gz-cmake
  • gz-tools
  • gz-utils
  • gz-utils.doc

@Guelakais
Copy link
Copy Markdown
Contributor Author

Guelakais commented Aug 22, 2025

short reminder: Currently this pr is based on #432783, so you can't merge this pr, because this would automatically merge the commits from the other pr!

@Guelakais Guelakais added this to ROS 2 Aug 22, 2025
@Guelakais Guelakais moved this to 🔖 Awaits the merge in ROS 2 Aug 22, 2025
@nixos-discourse
Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/5803

@Guelakais Guelakais changed the title gz-tools: init at 2.0.2 gz-tools: init at 2.0.3 Dec 5, 2025
Copy link
Copy Markdown
Contributor

@yzhou216 yzhou216 left a comment

Choose a reason for hiding this comment

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

Could you please use present tense verbs in the commit messages?

@Guelakais
Copy link
Copy Markdown
Contributor Author

Guelakais commented Dec 27, 2025

Could you please use present tense verbs in the commit messages?

done!

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Dec 27, 2025
@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 8.has: package (update) This PR updates a package to a newer version labels Jan 26, 2026
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. and removed 8.has: package (update) This PR updates a package to a newer version 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. labels Mar 16, 2026
@Guelakais
Copy link
Copy Markdown
Contributor Author

I think, it's now mergable, because this pr don't depends on other pr's anymore

coreutils # For env
];

buildInputs = [ gz-cmake ];
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.

ruby should be added to buildInputs and nativeCheckInputs as gz-tools ships a Ruby dispatcher (src/cmd/cmdtools.rb.in) that the gz binary invokes to route subcommands into each Gazebo library's CLI plugin. Without ruby in buildInputs, the binary is installed but every subcommand (gz topic, gz log, gz sim, ...) fails at runtime once downstream libraries are added.

You can see my buildInputs/nativeCheckInputs.

repo = "gz-tools";
tag = "gz-tools${lib.versions.major finalAttrs.version}_${finalAttrs.version}";
hash = "sha256-xMFJylj7OnDc7zVWiI4a/mvNpu9scz83F3bGopCt8l8=";
};
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.

Worth adding patches/pr-174.patch that I have in my implementation at these lines. I've opened a PR upstream in gazebosim/gz-tools#174.

gz-tools encodes a non-relative lookup for libbackward that fails inside the Nix store once LD_LIBRARY_PATH/DYLD_LIBRARY_PATH aren't globally populated.

I found that without it, any error path in gz sim segfaults inside backward-cpp instead of printing a stack trace. I found this happened with gz-sensors plugin-load failures.

buildInputs = [ gz-cmake ];

# Disable automatic shebang patching since we'll do it manually
dontPatchShebangs = true;
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.

Is there a reason you are patching shebangs manually? I found it wasn't required.

installCheckPhase = ''
# Verify the binary exists and can be executed
if [ -x "$out/bin/gz" ]; then
"$out/bin/gz" --help >/dev/null || true
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.

If you add || true failures will go unnoticed.

It could be worth replacing installCheckPhase with passthru.tests.version = testers.testVersion which runs as a separate derivation and is the nixpkgs standard pattern. You can see what I have done.


passthru = {
updateScript = nix-update-script {
attrPath = "gz-tools";
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.

Upstream tags look like gz-tools2_2.0.3 so you will need to use a regex so nix-update doesn't pick up unrelated refs. Suggest:

updateScript = nix-update-script {
  extraArgs = [ "--version-regex=gz-tools${lib.versions.major version}_([\\d\\.]+)" ];
};

meta = {
description = "Gazebo Sim tools collection";
homepage = "https://gazebosim.org/";
downloadPage = "https://github.com/gazebosim/gz-tools";
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.

Could be worth adding changelog = "https://github.com/gazebosim/gz-tools/blob/${finalAttrs.src.tag}/Changelog.md";

downloadPage = "https://github.com/gazebosim/gz-tools";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ guelakais ];
platforms = lib.platforms.all;
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.

It could be worth narrowing this asplatforms = lib.platforms.all includes mingw, wasi, and other platforms that have never been built. Perhaps use lib.platforms.linux ++ lib.platforms.darwin.

hash = "sha256-xMFJylj7OnDc7zVWiI4a/mvNpu9scz83F3bGopCt8l8=";
};

strictDeps = true;
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.

Since the nixpkgs-vet was last run against this PR, the requirement for new packet to include __structuredAttrs = true has been added. Suggest adding it to your implementation. It helps catch dependency leaks.

@github-project-automation github-project-automation Bot moved this from 🔖 Awaits the merge to 🏗 In progress in ROS 2 Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

4 participants