Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions nix/packages/github-matrix/github_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class NixEvalError(TypedDict):
}


def build_nix_eval_command(max_workers: int, flake_outputs: List[str]) -> List[str]:
def build_nix_eval_command(
max_workers: int, max_memory_size: int, flake_outputs: List[str]
) -> List[str]:
"""Build the nix-eval-jobs command with appropriate flags."""
nix_eval_cmd = [
"nix-eval-jobs",
Expand All @@ -104,6 +106,8 @@ def build_nix_eval_command(max_workers: int, flake_outputs: List[str]) -> List[s
"--option",
"accept-flake-config",
"true",
"--max-memory-size",
str(max_memory_size),
"--workers",
str(max_workers),
"--select",
Expand Down Expand Up @@ -168,7 +172,7 @@ def run_nix_eval_jobs(
Returns:
Tuple of (packages, warnings_list, errors_list)
"""
debug(f"Running command: {' '.join(cmd)}")
print(f"Running: {' '.join(cmd)}", file=sys.stderr)

# Disable colors in nix output
env = os.environ.copy()
Expand Down Expand Up @@ -280,6 +284,12 @@ def main() -> None:
parser = argparse.ArgumentParser(
description="Generate GitHub Actions matrix for Nix builds"
)
parser.add_argument(
"--max-memory-size",
default=3072,
type=int,
help="Maximum memory per eval worker in MiB. Defaults to 3072 (3 GiB).",
)
parser.add_argument(
"flake_outputs", nargs="+", help="Nix flake outputs to evaluate"
)
Expand All @@ -288,7 +298,7 @@ def main() -> None:

max_workers: int = os.cpu_count() or 1

cmd = build_nix_eval_command(max_workers, args.flake_outputs)
cmd = build_nix_eval_command(max_workers, args.max_memory_size, args.flake_outputs)

# Run evaluation and collect packages, warnings, and errors
packages, warnings_list, errors_list = run_nix_eval_jobs(cmd)
Expand Down
Loading