Nix-ros-flake for development with ros2 rust

[Nix-ros-flake](NixOS / nix-ros-flake · GitLab) for development with ros2 rust

The purpose of this flake is to streamline ROS 2 development with Rust. It’s designed to make Rust available via rustup and simplifies the setup process. In addition to the flake, the main_install.nu script can be used to locally download and install the necessary ROS 2 dependencies, facilitating a smoother development experience.

Getting started

This flake is designed to simply setup a ros2 workspace to work with.

Getting the Main Folder

To setup the starting point of your workspace, you can simply type in:

git clone https://gitlab.com/nixos8471109/nix-ros-flake ~/ros2_ws

Instead of ~/ros2_ws you can use, whatever path you want.

Setup the Workspace

Inside a ros2 workspace main folder, simply type:

nix develop -c colcon build

This will setup the ros2 workspace with the needed folders - build, install and src - to work with.

Getting needed Dependencies by ros2 rust

Because I’m using the nushell, I’m using a main_install.nu nushell script. Basically all it does is cloning the needed git repositories for developing ros2 packages using rclrs. It can be used through:

nu main_install.nu

Honorable Examples:

The following command builds all packages inside your src folder with the smallest possible footprint:

nix develop -c colcon --continue-on-error --merge-install
3 Likes