diff options
Diffstat (limited to 'shells/sub_bash.nix')
-rw-r--r-- | shells/sub_bash.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/shells/sub_bash.nix b/shells/sub_bash.nix new file mode 100644 index 0000000..656b385 --- /dev/null +++ b/shells/sub_bash.nix | |||
@@ -0,0 +1,16 @@ | |||
1 | # run with | ||
2 | # nix-shell shell.nix --run 'touch in ; tail -f in | bash & echo $! > pid' | ||
3 | # and then send commands with | ||
4 | # echo 'compute_me "1 + 3"' >> in | ||
5 | { pkgs ? import <nixpkgs> {} }: | ||
6 | pkgs.mkShell { | ||
7 | buildInputs = [ pkgs.bc ]; | ||
8 | shellHook = '' | ||
9 | compute_me() { | ||
10 | echo "$1" | bc; | ||
11 | } | ||
12 | export -f compute_me | ||
13 | |||
14 | echo "I’m ready" | ||
15 | ''; | ||
16 | } | ||