- Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Given the following cached-shell.nix:
{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell { shellHook = '' echo "Initialize something here (maybe a Postgres Database, for example)" export SOMEVAR="$OTHERVAR" ''; }This is how nix-shell behaves:
$ OTHERVAR=201 nix-shell cached-shell.nix Initialize something here (maybe a Postgres Database, for example) $ echo $SOMEVAR 201And this is cached-nix-shell (the echo command outputs nothing both with a cached shell and when caching it the first time):
$ OTHERVAR=201 cached-nix-shell cached-shell.nix $ echo $SOMEVAR So I think there's a difference in behavior. Would it be correct to say that the correct behavior for cached-nix-shell should be:
- Cache a derivation which is the shell derivation without its
shellHookattribute. However, take care to cache dependencies that might be brought in by${some-nix-var}inshellHook's body. - Run
shellHookeverytimecached-nix-shellruns.
Thanks in advance!
yorickvP
Metadata
Metadata
Assignees
Labels
No labels