2024-05-17 16:10:24 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This script verifies that the version of Nix installed on the runner
|
|
|
|
# matches the version supplied in the first argument.
|
2024-05-17 16:04:45 +02:00
|
|
|
|
|
|
|
EXPECTED_VERSION="${1}"
|
|
|
|
|
2024-05-17 16:10:24 +02:00
|
|
|
INSTALLED_NIX_VERSION_OUTPUT=$(nix --version)
|
|
|
|
INSTALLED_NIX_VERSION=$(echo "${INSTALLED_NIX_VERSION_OUTPUT}" | awk '{print $NF}')
|
2024-05-17 16:04:45 +02:00
|
|
|
EXPECTED_OUTPUT="nix (Nix) ${EXPECTED_VERSION}"
|
2024-05-17 16:10:24 +02:00
|
|
|
|
|
|
|
if [ "${INSTALLED_NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
|
|
|
|
echo "Nix version ${INSTALLED_NIX_VERSION} didn't match expected version ${EXPECTED_VERSION}"
|
2024-05-17 16:04:45 +02:00
|
|
|
exit 1
|
|
|
|
else
|
2024-05-17 16:10:24 +02:00
|
|
|
echo "Success! Nix version ${INSTALLED_NIX_VERSION} installed as expected"
|
|
|
|
exit 0
|
2024-05-17 16:04:45 +02:00
|
|
|
fi
|