flix59
October 29, 2020, 5:36pm
1
I would like to use this awesome repo (https://github.com/lopsided98/nix-ros-overlay ) to develop with ros. The example command
nix-shell
-I nix-ros-overlay=https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz
–option extra-substituters ‘https://ros.cachix.org ’
–option trusted-public-keys ‘cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=’
‘<nix-ros-overlay/examples/turtlebot3-gazebo.nix>’
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:
let
ros_overlay = import (builtins.fetchTarball https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz );
nixpkgs = import { overlays = [ ros_overlay ]; };
in
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:
let
ros_overlay = import (builtins.fetchTarball https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz);
in
with import <nixpkgs> { overlays = [ ros_overlay ]; };
2 Likes
flix59
October 29, 2020, 6:51pm
3
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:
let
ros = builtins.fetchTarball https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz;
ros_overlay = import ${ros}/overlay.nix
in
with import <nixpkgs> { overlays = [ ros_overlay ]; };
or just use the default.nix
let
ros = import (builtins.fetchTarball https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz) { };
in
with ros.pkgs;
1 Like
flix59
October 29, 2020, 8:10pm
6
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.