Nix no longer works inside nix develop inside a container

Hi guys

I’m experiencing something really weird. When I enter a development shell using nix develop then building nix stuff no longer works inside the shell (or at least when all of this happens inside a container).

I’ve made an example here:

The error message when running nix build inside nix develop is always something like the following:

error: builder for '/nix/store/gvh9z2yplwlh4sgn0ra1dqnvljaz740b-test.drv' failed with exit code 1;
       last 2 log lines:
       > unpacking sources
       > variable $src or $srcs should point to the source
       For full logs, run 'nix log /nix/store/gvh9z2yplwlh4sgn0ra1dqnvljaz740b-test.drv'.

Does this make sense to any of you?

2 Likes

I’ve found the cause for this weird error message!

nix develop for some reason sets TMPDIR to a different location. And for some reason, nix does not like this location :confused:

Setting TMPDIR back to /tmp in the shell’s shellHook makes the problem go away:
https://github.com/VanCoding/nix-run-inside-nix-develop-bug/commit/e623164518504fc11637508bf763652ec18ebac2

Isn’t this weird? Should I make a bug report?

2 Likes

What is that TMPDIR location which is set by nix develop ?

Something like /tmp/nix-shell.RSH8zx, so I guess it’s something that’s not set by nix develop itself but probably by mkShell