about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-17T12·34+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-17T12·34+0100
commite81d38c02b267eea93a91de3e8a00b185355d681 (patch)
treec0ffb0c0b00d592771d635a96279221d8730431b /doc
parent832377bbd6ccd43895ac346131cafe4901f7996b (diff)
nix-shell: Execute shellHook if it exists
Since normal builds don't execute shellHook, this allows nix-shell
specific customisation.  Suggested by Domen.
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/nix-shell.xml16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/manual/nix-shell.xml b/doc/manual/nix-shell.xml
index e57c726f5394..4b369662e2af 100644
--- a/doc/manual/nix-shell.xml
+++ b/doc/manual/nix-shell.xml
@@ -51,6 +51,22 @@ derivation for development.</para>
 <filename>shell.nix</filename> if it exists, and
 <filename>default.nix</filename> otherwise.</para>
 
+<para>If the derivation defines the variable
+<varname>shellHook</varname>, it will be evaluated after
+<literal>$stdenv/setup</literal> has been sourced.  Since this hook is
+not executed by regular Nix builds, it allows you to perform
+initialisation specific to <command>nix-shell</command>.  For example,
+the derivation attribute
+
+<programlisting>
+shellHook =
+  ''
+    echo "Hello shell!"
+  '';
+</programlisting>
+
+will cause <command>nix-shell</command> to print <literal>Hello shell!</literal>.</para>
+
 </refsection>