From c29d44b49a734b3268cf49811356ff4483fb6ed2 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 1 Feb 2021 22:53:24 +0100 Subject: [PATCH] ci: use 'cachix watch-exec' Simplifies the build script. This feature appeared in a recent cachix update. --- ci/build-to-cachix.sh | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/ci/build-to-cachix.sh b/ci/build-to-cachix.sh index 73a8260..0fbbd5a 100755 --- a/ci/build-to-cachix.sh +++ b/ci/build-to-cachix.sh @@ -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