#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail flake_json=$(nix flake show --json) build_and_push() { local expr="$1" nix build "$expr" --no-link --print-out-paths | while IFS= read -r path; do attic push main "$path" done } jq -r '.nixosConfigurations | keys[]' <<<"$flake_json" | while IFS= read -r cfg; do expr=".#nixosConfigurations.\"$cfg\".config.system.build.toplevel" build_and_push "$expr" done