feat: add cachix push script for pre-building ATM binaries

Build the system closure locally and push all store paths to
aiolabs.cachix.org so ATMs pull binaries instead of building
from source (which freezes the 2GB RAM hardware).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-03-02 14:01:09 -05:00
commit aece711450

55
deploy/push-cache.sh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Build the douro-installed system closure and push all paths to cachix.
#
# Run from your dev machine (Arch) after pushing code to the repo.
# Requires: nix (Determinate), cachix (authenticated via ~/.config/cachix/cachix.dhall)
#
# Usage:
# ./deploy/push-cache.sh # build + push douro-installed
# ./deploy/push-cache.sh douro # same as above (default)
# ./deploy/push-cache.sh tejo # build + push tejo live config
# ./deploy/push-cache.sh all # build + push all configs
set -euo pipefail
CACHE="aiolabs"
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
target="${1:-douro}"
build_and_push() {
local name="$1"
local attr="$2"
echo "==> Building $name ($attr)..."
nix build ".#$attr" --no-link --print-out-paths | cachix push "$CACHE"
echo "==> Pushed $name to $CACHE.cachix.org"
}
case "$target" in
douro)
build_and_push "douro-installed toplevel" "nixosConfigurations.douro-installed.config.system.build.toplevel"
;;
douro-live)
build_and_push "douro live ISO" "iso-douro"
;;
tejo)
build_and_push "tejo live ISO" "iso-tejo"
;;
sintra)
build_and_push "sintra live ISO" "iso-sintra"
;;
all)
build_and_push "douro-installed toplevel" "nixosConfigurations.douro-installed.config.system.build.toplevel"
build_and_push "douro live ISO" "iso-douro"
build_and_push "tejo live ISO" "iso-tejo"
build_and_push "sintra live ISO" "iso-sintra"
;;
*)
echo "Usage: $0 [douro|douro-live|tejo|sintra|all]"
exit 1
;;
esac
echo ""
echo "Done. ATMs will pull binaries from https://$CACHE.cachix.org on next upgrade."