From b7be7029bffeb5be2fc00833a25dd8cf0aac3a48 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sat, 24 Feb 2024 20:15:09 +0100 Subject: [PATCH] README: Add example of using the overlay in flake.nix --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index a857caaa99..773720538e 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,46 @@ roslaunch turtlebot3_gazebo turtlebot3_world.launch roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch ``` +### Flakes + With [Flakes enabled][flake], the equivalent of the above is: ``` nix develop github:lopsided98/nix-ros-overlay#example-turtlebot3-gazebo # Then use roslaunch commands as above ``` +Using the overlay in your `flake.nix`-based project could look like this: + +```nix +{ + inputs = { + nix-ros-overlay.url = "github:lopsided98/nix-ros-overlay"; + nixpkgs.follows = "nix-ros-overlay/nixpkgs"; # IMPORTANT!!! + }; + outputs = { self, nix-ros-overlay, nixpkgs }: + nix-ros-overlay.inputs.flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ nix-ros-overlay.overlays.default ]; + }; + in { + devShells.default = pkgs.mkShell { + name = "Example project"; + packages = with pkgs.rosPackages.humble; [ + pkgs.colcon + ros-core + # ... + ]; + }; + }); + nixConfig = { + extra-substituters = [ "https://ros.cachix.org" ]; + extra-trusted-public-keys = [ "ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=" ]; + }; +} +``` + [flake]: https://nixos.wiki/wiki/Flakes#Enable_flakes ## Current status