diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-07-22 01:16:01 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-07-22 01:16:01 +0200 |
commit | 8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676 (patch) | |
tree | 647e9737344bef2206b082222d7ff87307fd91c2 /shells/sub_bash.nix | |
download | Nixies-8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676.tar.gz Nixies-8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676.tar.zst Nixies-8eb07d94a12f0fb8d4a8f15043aedc8cadd7c676.zip |
Initial commit
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 | } | ||