ops-jrz1/scripts/hooks/nix-build-hook.sh
Dan 894e7241f1 Initialize ops-jrz1 repository with Matrix platform extraction foundation
- Add speckit workflow infrastructure (.claude, .specify)
- Create NixOS configuration skeleton (flake.nix, configuration.nix, hosts/ops-jrz1.nix)
- Add sanitization scripts with 22 rules for personal info removal
- Add validation scripts with gitleaks integration
- Configure git hooks (pre-commit, pre-push) for security validation
- Add project documentation (README, LICENSE)
- Add comprehensive .gitignore for Nix, secrets, staging

Phase 1 and Phase 2 complete. Foundation ready for module extraction from ops-base.
2025-10-13 13:37:17 -07:00

38 lines
1,004 B
Bash
Executable file

#!/usr/bin/env bash
#
# Pre-push hook: Validate builds
#
# This hook attempts to build the ops-jrz1 configuration
# to ensure it's valid before pushing to remote.
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Get repository root
REPO_ROOT="$(git rev-parse --show-toplevel)"
echo "==> Running build validation..."
# Check if flake.nix exists
if [ ! -f "$REPO_ROOT/flake.nix" ]; then
echo -e "${YELLOW}⚠ WARNING: flake.nix not found, skipping build validation${NC}"
exit 0
fi
# Try to build ops-jrz1 configuration
if nix build "$REPO_ROOT#nixosConfigurations.ops-jrz1.config.system.build.toplevel" --no-link --show-trace 2>&1 | head -20; then
echo -e "${GREEN}✓ Build validation passed${NC}"
exit 0
else
echo -e "${RED}✗ Build validation failed${NC}"
echo ""
echo "Push blocked. Please fix the build errors and try again."
echo "Debug with: nix build .#nixosConfigurations.ops-jrz1 --show-trace"
exit 1
fi