From 0de64463fd193b7239f18897a46dac2efc098cde Mon Sep 17 00:00:00 2001 From: monkey-w1n5t0n Date: Sat, 11 Apr 2026 07:58:43 +0200 Subject: [PATCH] build(faust): auto re-exec under nix-shell when faust is missing If faust isn't in PATH but nix-shell is, transparently re-exec the script via `nix-shell -p faust --run` instead of erroring out with a hint. NISPS_BUILD_IN_NIX_SHELL guards against infinite recursion if the shell somehow still lacks faust. --- playground/faust/build.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/playground/faust/build.sh b/playground/faust/build.sh index b92dbcf..8124ef3 100755 --- a/playground/faust/build.sh +++ b/playground/faust/build.sh @@ -24,10 +24,22 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # --------------------------------------------------------------------------- # Dependency checks # --------------------------------------------------------------------------- +# +# If faust isn't in PATH, automatically re-exec under `nix-shell -p faust` +# when nix-shell is available. NISPS_BUILD_IN_NIX_SHELL prevents infinite +# recursion if the nix-shell environment somehow still lacks faust. if ! command -v faust &>/dev/null; then + if [ "${NISPS_BUILD_IN_NIX_SHELL:-0}" = "1" ]; then + echo "ERROR: 'faust' still not found inside nix-shell. Check your nixpkgs channel." + exit 1 + fi + if command -v nix-shell &>/dev/null; then + echo "faust not in PATH — re-exec under nix-shell -p faust ..." + exec env NISPS_BUILD_IN_NIX_SHELL=1 nix-shell -p faust --run "\"$0\" $*" + fi echo "" - echo "ERROR: 'faust' not found in PATH." + echo "ERROR: 'faust' not found in PATH (and nix-shell is unavailable)." echo "" echo "Install options:" echo " nix-shell -p faust # one-off"