Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Packages from outside the registry #492

Open
olistrik opened this issue Sep 27, 2024 · 1 comment
Open

[Question] Packages from outside the registry #492

olistrik opened this issue Sep 27, 2024 · 1 comment

Comments

@olistrik
Copy link

Hi there,

I'm working with a few ROS packages that are not part of the package registry and are also not (yet) available from this repository. So I've packaged them myself with the buildRosPackage builder. Now there's a potential that some of my colleagues would like to use these packages too.

I understand from the FAQ, for generic dependencies I should try to get them merged upstream to nixpkgs, but what should I do with actual ROS packages?

Based on previous experience, I can see three possible options but I'm not sure what the standard is for this project:

  1. I open an MR for them here like I would for nixpkgs, though I'm not sure if I'm in a position to be a maintainer of a derivation. I also don't see much evidence of this being the situation?

  2. I maintain my own repo of packages and try to match the structure here as much as possible, this is pretty much what I'm already doing just not publicly (yet).

  3. Where possible I try to either get packages into the official registry so they eventually end up here, or I try to get a project maintainer to include a flake.nix in the repo exporting their package in a way that can be consumed along with this project. I've never had much luck though getting non-nixers to adopt a flake file, even if I offer to maintain it.

In regards to 2 and 3 I'm currently exporting an overlay from my flake like this:

      overlays.default = (final: prev: {
        livox-sdk2 = prev.callPackage ./pkgs/livox-sdk2 { };

        rosPackages = prev.rosPackages // {
          humble = prev.rosPackages.humble.overrideScope (final: prev: {
            point-lio = prev.callPackage ./pkgs/point-lio { };
            livox-ros-driver2 = prev.callPackage ./pkgs/livos-ros-driver2 { };
          });
        };
      });

It's not the most scalable as I'd prefer to be building for all ROS distros possible, but I think that this is the most ideal way of exporting packages? Unless I've missed a utility function somewhere.

But yeah, basically my question is if there is already a standard for this.

@wentasah
Copy link
Contributor

wentasah commented Sep 27, 2024

Hi!

For applying your overlay to all distros, you can use this code.

I'd also like to point out to my ros2nix tool, which might be useful for what you're trying to do. Its goal to automatically create Nix expressions from package.xml. It will probably not work directly for livox-ros-driver2, because (at least in my case) it needs applying some unmerged PRs, but I'm successfully using the tool for many other non-official ROS packages.

[edit] It might work for livox-ros-driver2, I meant livox-ros2-driver.

Ideally, it should not be necessary to host Nix expressions in separate repositories, but they should be automatically generated. And if it doesn't work, PRs should be sent upstream (package.xml or other files) to fix that. I think that ros2nix can help achieving this. The only complication is that some packages depend on proprietary packages (various SDKs, etc.), which must be packaged for Nix manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants