From 8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 22 Jul 2020 01:16:01 +0200 Subject: Initial commit --- shells/sub_bash.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 shells/sub_bash.nix (limited to 'shells/sub_bash.nix') 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 @@ +# run with +# nix-shell shell.nix --run 'touch in ; tail -f in | bash & echo $! > pid' +# and then send commands with +# echo 'compute_me "1 + 3"' >> in +{ pkgs ? import {} }: +pkgs.mkShell { + buildInputs = [ pkgs.bc ]; + shellHook = '' + compute_me() { + echo "$1" | bc; + } + export -f compute_me + + echo "I’m ready" + ''; +} -- cgit v1.2.3