2026-11-30 19:20:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
2026-11-30 22:46:50 +00:00
|
|
|
# Param: IMAGE ($1) - the image name shown in the missing-nix error.
|
|
|
|
|
# Param: PKGMGR_DISTRO ($2) - the distro shown in the missing-nix error.
|
2026-11-30 19:20:37 +00:00
|
|
|
IMAGE="$1"
|
|
|
|
|
PKGMGR_DISTRO="$2"
|
|
|
|
|
|
2026-11-30 22:46:50 +00:00
|
|
|
bash scripts/test/container/safe-directory.sh
|
2026-11-30 19:20:37 +00:00
|
|
|
|
|
|
|
|
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
|
2026-11-30 22:46:50 +00:00
|
|
|
# shellcheck source=/dev/null
|
2026-11-30 19:20:37 +00:00
|
|
|
source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh
|
|
|
|
|
elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then
|
2026-11-30 22:46:50 +00:00
|
|
|
# shellcheck source=/dev/null
|
2026-11-30 19:20:37 +00:00
|
|
|
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."
|