Add a global variable ‘inNixShell’
This is primarily useful in Nix expressions that are also intended to be used by nix-shell. It allows saying things like: buildInputs = [ ... ] ++ (if inNixShell then [ emacs ] else [ ]); This should not be used in Nixpkgs (since the question of what constitutes a useful nix-shell environment is very subjective).
This commit is contained in:
parent
484403bf0e
commit
4a91cfd32b
@ -47,4 +47,7 @@ rec {
|
||||
readFile ../.version
|
||||
+ (if pathExists suffixFile then readFile suffixFile else "pre-git");
|
||||
|
||||
# Whether we're being called by nix-shell. This is useful to
|
||||
inNixShell = builtins.getEnv "IN_NIX_SHELL" == "1";
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user