#!@bash@/bin/bash set -euo pipefail [[ $# -gt 0 && "$1" == print-paths ]] || { echo 'This is just a simple Nix adapter for `leanpkg print-paths`. Please use the `lean-all` attribute for the real thing.'; exit 1; } shift deps="$@" root=. # fall back to initial package if not in package [[ ! -f "$root/flake.nix" ]] && root="@srcRoot@" target="$root#print-paths" args=() # HACK: use stage 0 instead of 1 inside Lean's own `src/` [[ -d Lean && -f ../flake.nix ]] && target="@srcTarget@print-paths" && args=@srcArgs@ for dep in $deps; do target="$target.\"$dep\"" done echo "Building dependencies..." >&2 # -v only has "built ...", but "-vv" is a bit too verbose @nix@/bin/nix run "$target" ${args[*]} -v