diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -105,9 +105,14 @@ # shell commands to be ran upon entering shell shellHook = '' + PRJ_ROOT=$(git rev-parse --show-toplevel) + # Set development environment variable defaults source "${../scripts/source_development_defaults.sh}" + # Cache development path for some use cases such as XCode + "$PRJ_ROOT/scripts/save_path.sh" + '' # Darwin condition can be removed once linux services are supported + lib.optionalString stdenv.isDarwin '' diff --git a/scripts/save_path.sh b/scripts/save_path.sh new file mode 100755 --- /dev/null +++ b/scripts/save_path.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Save the `PATH` to a known location, this is to aide with xcode which will +# unset all environment variables before attempting builds + +COMM_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/comm" + +mkdir -p "$COMM_CACHE" + +echo "export PATH=$PATH\${PATH:+:}\"\$PATH\"" > "$COMM_CACHE"/path