From e81d38c02b267eea93a91de3e8a00b185355d681 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Feb 2014 13:34:24 +0100 Subject: nix-shell: Execute shellHook if it exists Since normal builds don't execute shellHook, this allows nix-shell specific customisation. Suggested by Domen. --- doc/manual/nix-shell.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/manual/nix-shell.xml') 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. shell.nix if it exists, and default.nix otherwise. +If the derivation defines the variable +shellHook, it will be evaluated after +$stdenv/setup has been sourced. Since this hook is +not executed by regular Nix builds, it allows you to perform +initialisation specific to nix-shell. For example, +the derivation attribute + + +shellHook = + '' + echo "Hello shell!" + ''; + + +will cause nix-shell to print Hello shell!. + -- cgit 1.4.1