ci: use 'cachix watch-exec'

Simplifies the build script.
This feature appeared in a recent cachix update.
This commit is contained in:
Erik Arvstedt 2021-02-01 22:53:24 +01:00
parent 6a32812412
commit c29d44b49a
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -11,18 +11,8 @@ cachixCache=nix-bitcoin
trap 'echo Error at line $LINENO' ERR
atExit() {
rm -rf $tmpDir
if [[ -v cachixPid ]]; then stopCachix; fi
}
tmpDir=$(mktemp -d -p /tmp)
trap atExit EXIT
stopCachix() {
kill $cachixPid 2>/dev/null || true
# Wait for cachix to finish
tail --pid=$cachixPid -f /dev/null
}
trap "rm -rf $tmpDir" EXIT
## Instantiate
@ -43,14 +33,14 @@ fi
if [[ $CACHIX_SIGNING_KEY ]]; then
# Speed up task by uploading store paths as soon as they are created
cachix push $cachixCache --watch-store &
cachixPid=$!
buildCmd="cachix watch-exec $cachixCache nix-build --"
else
buildCmd=nix-build
fi
nix-build --out-link $tmpDir/result $tmpDir/drv >/dev/null
$buildCmd --out-link $tmpDir/result $tmpDir/drv >/dev/null
if [[ $CACHIX_SIGNING_KEY ]]; then
stopCachix
cachix push $cachixCache $outPath
fi