Build Vs Shell - Nix

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Magnus Therning

Is there some way of, inside a Nix expression, observing whether it's nix-build or nix-shell that's running?
I want to have a few extra packages available in my Nix shell, but they're not necessary for building.

Ben Kolera

nix-repl> (import <nixpkgs> {}).lib.inNixShell
false