From 7c36e1c027470e68ce22451430f33bbb2de2cd45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= Date: Mon, 23 Feb 2026 12:50:31 +0100 Subject: [PATCH 1/2] feat: limit nix-eval-jobs max memory to 3 GiB per worker --- nix/packages/github-matrix/github_matrix.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nix/packages/github-matrix/github_matrix.py b/nix/packages/github-matrix/github_matrix.py index 81385c2151..e5cacbeb0d 100755 --- a/nix/packages/github-matrix/github_matrix.py +++ b/nix/packages/github-matrix/github_matrix.py @@ -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", @@ -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", @@ -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" ) @@ -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) From ef04f08fe5f400ec8381204276712a1e34b3277b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= Date: Mon, 23 Feb 2026 12:53:51 +0100 Subject: [PATCH 2/2] feat: log nix-eval-jobs command to stderr --- nix/packages/github-matrix/github_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/packages/github-matrix/github_matrix.py b/nix/packages/github-matrix/github_matrix.py index e5cacbeb0d..7c1e32d755 100755 --- a/nix/packages/github-matrix/github_matrix.py +++ b/nix/packages/github-matrix/github_matrix.py @@ -172,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()