Something went wrong. Try again.
atproto Thingiverse but good
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051#!/usr/bin/env bashset -euo pipefailif (($# == 0)); then echo "usage: tools/in-dev-shell _private-recipe [args ...]" >&2 exit 2fiprivate_recipe=$1shiftif ! just_bin=$(command -v just); then echo "error: just is required to dispatch Polymodel recipes" >&2 exit 127fiif [[ "${POLYMODEL_NIX_SHELL:-}" == 1 && -n "${LDRAWDIR:-}" && -d "${LDRAWDIR}" ]]; then exec "$just_bin" "$private_recipe" "$@"fiif ! nix_bin=$(command -v nix); then echo "error: nix is required to enter the Polymodel dev shell" >&2 exit 127fiscript_path=${BASH_SOURCE[0]}[[ $script_path == */* ]] || script_path=./$script_pathroot=$(cd "${script_path%/*}/.." && pwd)flake_ref=$rootif [[ -e "$root/.jj" && ! -e "$root/.git" ]]; then if ! jj_bin=$(command -v jj); then echo "error: jj is required to materialize a secondary-workspace flake" >&2 exit 127 fi snapshot=$($jj_bin --repository "$root" log -r @ --no-graph -T 'commit_id') cache_root=${XDG_CACHE_HOME:-${HOME}/.cache}/polymodel/jj-flakes flake_ref=$cache_root/$snapshot if [[ ! -f "$flake_ref/flake.nix" ]]; then mkdir -p "$cache_root" staging=$(mktemp -d "$cache_root/.staging.XXXXXX") trap 'rm -rf "$staging"' EXIT "$jj_bin" --repository "$root" file list -r @ -T 'path ++ "\0"' \ | tar -C "$root" --null --verbatim-files-from -T - -cf - \ | tar -xf - -C "$staging" mv "$staging" "$flake_ref" 2>/dev/null || true fifiprintf '==> entering Polymodel dev shell for: %s\n' "${private_recipe#_}" >&2exec "$nix_bin" develop "$flake_ref" --command "$just_bin" "$private_recipe" "$@"