nix-bitcoin/ci/build.sh
Erik Arvstedt 466d23deaa
ci: extract build-to-cachix.sh
Needed by the following commits.
Also, don't use the cachix cache as a substituter for local, non-CI
builds. This obviates the need for the 'untrusted' warning in build.sh.
2020-12-11 13:27:05 +01:00

30 lines
713 B
Bash
Executable File

#!/usr/bin/env bash
# This script can also be run locally for testing:
# scenario=default ./build.sh
#
# When variable CIRRUS_CI is unset, this script leaves no persistent traces on the host system.
set -euo pipefail
scenario=${scenario:-}
if [[ -v CIRRUS_CI && $scenario ]]; then
if [[ ! -e /dev/kvm ]]; then
>&2 echo "No KVM available on VM host."
exit 1
fi
# Enable KVM access for nixbld users
chmod o+rw /dev/kvm
fi
echo "$NIX_PATH ($(nix eval --raw nixpkgs.lib.version))"
if [[ $scenario ]]; then
buildExpr=$(../test/run-tests.sh --scenario $scenario exprForCI)
else
buildExpr="import ./build.nix"
fi
"${BASH_SOURCE[0]%/*}/build-to-cachix.sh" -E "$buildExpr"