#!/usr/bin/env bash set -euo pipefail # Param: IMAGE ($1) - the image name shown in the missing-nix error. # Param: PKGMGR_DISTRO ($2) - the distro shown in the missing-nix error. IMAGE="$1" PKGMGR_DISTRO="$2" bash scripts/test/container/safe-directory.sh echo ">>> preflight: nix must exist in image" if ! command -v nix >/dev/null 2>&1; then echo "NO_NIX" echo "ERROR: nix not found in image ${IMAGE} (PKGMGR_DISTRO=${PKGMGR_DISTRO})" echo "HINT: Ensure Nix is installed during image build for this distro." exit 1 fi echo ">>> nix version" nix --version if [[ -f /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh ]]; then # shellcheck source=/dev/null source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then # shellcheck source=/dev/null source ./scripts/nix/lib/retry_403.sh else echo "ERROR: retry helper not found: scripts/nix/lib/retry_403.sh" exit 1 fi echo ">>> nix flake show" run_with_github_403_retry nix flake show . --no-write-lock-file >/dev/null echo ">>> nix build .#default" run_with_github_403_retry nix build .#default --no-link --no-write-lock-file echo ">>> nix run .#pkgmgr -- --help" run_with_github_403_retry nix run .#pkgmgr -- --help --no-write-lock-file echo ">>> OK: Nix flake-only test succeeded."