ci: use 'cachix watch-exec'
Simplifies the build script. This feature appeared in a recent cachix update.
This commit is contained in:
parent
6a32812412
commit
c29d44b49a
|
@ -11,18 +11,8 @@ cachixCache=nix-bitcoin
|
||||||
|
|
||||||
trap 'echo Error at line $LINENO' ERR
|
trap 'echo Error at line $LINENO' ERR
|
||||||
|
|
||||||
atExit() {
|
|
||||||
rm -rf $tmpDir
|
|
||||||
if [[ -v cachixPid ]]; then stopCachix; fi
|
|
||||||
}
|
|
||||||
tmpDir=$(mktemp -d -p /tmp)
|
tmpDir=$(mktemp -d -p /tmp)
|
||||||
trap atExit EXIT
|
trap "rm -rf $tmpDir" EXIT
|
||||||
|
|
||||||
stopCachix() {
|
|
||||||
kill $cachixPid 2>/dev/null || true
|
|
||||||
# Wait for cachix to finish
|
|
||||||
tail --pid=$cachixPid -f /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
## Instantiate
|
## Instantiate
|
||||||
|
|
||||||
|
@ -43,14 +33,14 @@ fi
|
||||||
|
|
||||||
if [[ $CACHIX_SIGNING_KEY ]]; then
|
if [[ $CACHIX_SIGNING_KEY ]]; then
|
||||||
# Speed up task by uploading store paths as soon as they are created
|
# Speed up task by uploading store paths as soon as they are created
|
||||||
cachix push $cachixCache --watch-store &
|
buildCmd="cachix watch-exec $cachixCache nix-build --"
|
||||||
cachixPid=$!
|
else
|
||||||
|
buildCmd=nix-build
|
||||||
fi
|
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
|
if [[ $CACHIX_SIGNING_KEY ]]; then
|
||||||
stopCachix
|
|
||||||
cachix push $cachixCache $outPath
|
cachix push $cachixCache $outPath
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user