#!/usr/bin/env bash # Run a command in the pinned nixos/nix container, with this worktree mounted at /src. set -euo pipefail cd "$(dirname "$0")/.." image="${NIX_IMAGE:?run through mise, which sets NIX_IMAGE}" # One store volume per image tag: a new volume starts as a copy of the image's /nix. store="spindle-nix-$(printf '%s' "${image#*:}" | tr -c 'a-zA-Z0-9' '-')" docker run --rm \ -e NIX_CONFIG='experimental-features = nix-command flakes' \ -v "$store:/nix" \ -v spindle-nix-cache:/root/.cache \ -v "$PWD:/src" \ -w /src \ "$image" "$@"