2020-12-02 11:09:08 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This script can also be run locally for testing:
|
2022-10-22 10:37:58 -07:00
|
|
|
# ./build.sh <scenario>
|
2020-12-02 11:09:08 -08:00
|
|
|
#
|
|
|
|
# When variable CIRRUS_CI is unset, this script leaves no persistent traces on the host system.
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-10-22 10:37:58 -07:00
|
|
|
scenario=$1
|
|
|
|
|
2021-12-10 05:07:56 -08:00
|
|
|
if [[ -v CIRRUS_CI ]]; then
|
2020-12-11 04:26:07 -08:00
|
|
|
if [[ ! -e /dev/kvm ]]; then
|
|
|
|
>&2 echo "No KVM available on VM host."
|
|
|
|
exit 1
|
2020-12-02 11:09:08 -08:00
|
|
|
fi
|
2020-12-11 04:26:07 -08:00
|
|
|
# Enable KVM access for nixbld users
|
|
|
|
chmod o+rw /dev/kvm
|
2020-12-02 11:09:08 -08:00
|
|
|
fi
|
|
|
|
|
2022-10-22 10:37:58 -07:00
|
|
|
cd "${BASH_SOURCE[0]%/*}"
|
|
|
|
exec ./build-to-cachix.sh --expr "(builtins.getFlake (toString ../..)).legacyPackages.\${builtins.currentSystem}.tests.$scenario"
|