Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
gwg313 2025-08-16 01:32:32 -04:00
parent 0d1d451171
commit 5f9fb27ebb
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
17 changed files with 201 additions and 120 deletions

33
build_all.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
# FLAKE_PATH="${1:-/tmp/flake}"
FLAKE_PATH=./flake.nix
CACHE="mycache"
GC_ROOT="/tmp/gcroots-ci"
mkdir -p "$GC_ROOT"
declare -a paths_to_push
# Build all NixOS configs
nixos_configs=$(nix eval --json "$FLAKE_PATH#nixosConfigurations" --apply 'builtins.attrNames' | jq -r '.[]')
for host in $nixos_configs; do
echo "▶ Building NixOS config: $host"
out_path=$(nix build --print-out-paths "$FLAKE_PATH#nixosConfigurations.${host}.config.system.build.toplevel")
paths_to_push+=("$out_path")
done
# Build all Home Manager configs
home_configs=$(nix eval --json "$FLAKE_PATH#homeConfigurations" --apply 'builtins.attrNames' | jq -r '.[]')
for user in $home_configs; do
echo "▶ Building Home config: $user"
out_path=$(nix build --print-out-paths "$FLAKE_PATH#homeConfigurations.${user}.activationPackage")
paths_to_push+=("$out_path")
done
# Push all at once
echo "📦 Pushing ${#paths_to_push[@]} paths to attic cache: $CACHE"
attic push "$CACHE" "${paths_to_push[@]}"
# Clean up
nix store delete "${paths_to_push[@]}"