NixShell for overlay

I would like to use this awesome repo ( to develop with ros. The example command

-I nix-ros-overlay=
–option extra-substituters ‘
–option trusted-public-keys ‘’

works fine. But I need to add an environment variable to the shell and I really would like it to put all of this in an own default.nix that I can just call nix-sell. This is what I came up with so far:

ros_overlay = import (builtins.fetchTarball;
nixpkgs = import { overlays = [ ros_overlay ]; };
with nixpkgs;
stdenv.mkDerivation {
name = “ros_overlay_shell”;
VARIABLE = “my/path/variable”

that gives me an infinite recursion at line 3 (nixpkgs= ...) I don’t really know how to fix this.

usually you would say something lke:

ros_overlay = import (builtins.fetchTarball;
with import <nixpkgs> { overlays = [ ros_overlay ]; };

Thanks for the fast reply,
this still gives me a infinite recursion at the line

with import <nixpkgs> { overlays = [ ros_overlay  ]; };

looks to be that nix-ros-overlay/default.nix at e275dce414d9e7850e4287f5353d8a7c63491d8d · lopsided98/nix-ros-overlay · GitHub is what is getting evaluated with the import, which is already nixpkgs with the overlay applied.

if you want to use the overlay specifically, you need to do:

ros = builtins.fetchTarball;
ros_overlay = import ${ros}/overlay.nix
with import <nixpkgs> { overlays = [ ros_overlay ]; };

or just use the default.nix

ros = import (builtins.fetchTarball { };
with ros.pkgs;
1 Like

the first option gives me a syntax error for the $ if i put it in " the shell loads but the ros packages aren’t installed. The second option does the same, it loads the shell but the packages are not able to start because they are not found

maybe make an issue with the github repo to expand documentation a bit.