diff --git a/doc/manual/nix-shell.xml b/doc/manual/nix-shell.xml index 866b3413b9..e57c726f53 100644 --- a/doc/manual/nix-shell.xml +++ b/doc/manual/nix-shell.xml @@ -31,20 +31,26 @@ cmd regexp - paths + path Description -The command nix-shell will build -the dependencies of the specified derivation, but not the derivation +The command nix-shell will build the +dependencies of the specified derivation, but not the derivation itself. It will then start an interactive shell in which all -environment variables defined by the derivation have been set to their -corresponding values, and the script $stdenv/setup -has been sourced. This is useful for reproducing the environment of a +environment variables defined by the derivation +path have been set to their corresponding +values, and the script $stdenv/setup has been +sourced. This is useful for reproducing the environment of a derivation for development. +If path is not given, +nix-shell defaults to +shell.nix if it exists, and +default.nix otherwise. + diff --git a/scripts/nix-build.in b/scripts/nix-build.in index 168730bbc9..fff71021fb 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -149,7 +149,8 @@ for (my $n = 0; $n < scalar @ARGV; $n++) { } } -@exprs = ("./default.nix") if scalar @exprs == 0; +@exprs = ("shell.nix") if scalar @exprs == 0 && $runEnv && -e "shell.nix"; +@exprs = ("default.nix") if scalar @exprs == 0; $ENV{'IN_NIX_SHELL'} = 1 if $runEnv;