blob: 656b3858ab421741e6d8aac218df21e234b3d8c2 (
plain) (
tree)
|
|
# 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 <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [ pkgs.bc ];
shellHook = ''
compute_me() {
echo "$1" | bc;
}
export -f compute_me
echo "I’m ready"
'';
}
|