How can I tell if I'm inside of a `nix build`?

How can I determine whether or not I’m running inside of a nix build, but not a nix-shell, nix develop, etc?

The presence of NIX_BUILD_TOP doesn’t work – that’s available in nix develop and the rest…

you can probably check for presence of $IN_NIX_SHELL as well.

1 Like