ops-jrz1/scripts/hooks/nix-flake-check-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
892 B
Bash
Executable file

#!/usr/bin/env bash
#
# Pre-push hook: Run nix flake check
#
# This hook validates that the flake configuration is valid
# and all checks pass 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 nix flake check..."
# Check if flake.nix exists
if [ ! -f "$REPO_ROOT/flake.nix" ]; then
echo -e "${YELLOW}⚠ WARNING: flake.nix not found, skipping nix flake check${NC}"
exit 0
fi
# Run nix flake check
if nix flake check "$REPO_ROOT" --show-trace 2>&1; then
echo -e "${GREEN}✓ nix flake check passed${NC}"
exit 0
else
echo -e "${RED}✗ nix flake check failed${NC}"
echo ""
echo "Push blocked. Please fix the flake errors and try again."
echo "Debug with: nix flake check --show-trace"
exit 1
fi