| 1 | #!/usr/bin/env bash |
| 2 | # The sibling of the nix stub: `nix-store --query --references <drv>` over |
| 3 | # the derivations it writes. One opaque store path per input file, named by |
| 4 | # the file's content, which is what makes the closure content-addressed. |
| 5 | set -euo pipefail |
| 6 | |
| 7 | drv="${*: -1}" |
| 8 | [ -f "$drv" ] || { echo "nix-store (stub): no such derivation: $drv" >&2; exit 1; } |
| 9 | while read -r sum path; do |
| 10 | printf '/nix/store/%s-%s\n' "$sum" "${path//\//_}" |
| 11 | done < "$drv" |