aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/src/command-ref/nix-shell.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/manual/src/command-ref/nix-shell.md')
-rw-r--r--doc/manual/src/command-ref/nix-shell.md19
1 files changed, 13 insertions, 6 deletions
diff --git a/doc/manual/src/command-ref/nix-shell.md b/doc/manual/src/command-ref/nix-shell.md
index 72f6730f1..a2b6d8a8e 100644
--- a/doc/manual/src/command-ref/nix-shell.md
+++ b/doc/manual/src/command-ref/nix-shell.md
@@ -11,8 +11,8 @@
[`--command` *cmd*]
[`--run` *cmd*]
[`--exclude` *regexp*]
- [--pure]
- [--keep *name*]
+ [`--pure`]
+ [`--keep` *name*]
{{`--packages` | `-p`} {*packages* | *expressions*} … | [*path*]}
# Description
@@ -101,7 +101,8 @@ The following common options are supported:
- `NIX_BUILD_SHELL`\
Shell used to start the interactive environment. Defaults to the
- `bash` found in `PATH`.
+ `bash` found in `<nixpkgs>`, falling back to the `bash` found in
+ `PATH` if not found.
# Examples
@@ -110,13 +111,19 @@ shell in which to build it:
```console
$ nix-shell '<nixpkgs>' -A pan
-[nix-shell]$ unpackPhase
+[nix-shell]$ eval ${unpackPhase:-unpackPhase}
[nix-shell]$ cd pan-*
-[nix-shell]$ configurePhase
-[nix-shell]$ buildPhase
+[nix-shell]$ eval ${configurePhase:-configurePhase}
+[nix-shell]$ eval ${buildPhase:-buildPhase}
[nix-shell]$ ./pan/gui/pan
```
+The reason we use form `eval ${configurePhase:-configurePhase}` here is because
+those packages that override these phases do so by exporting the overridden
+values in the environment variable of the same name.
+Here bash is being told to either evaluate the contents of 'configurePhase',
+if it exists as a variable, otherwise evaluate the configurePhase function.
+
To clear the environment first, and do some additional automatic
initialisation of the interactive shell: