Skip to content

Commit 2e17aa2

Browse files
committed
[CELL-297] CI thin builds no longer OOM-killed on 8 GB ARM runners — nix max-jobs capped at 2 via DEVCELL_NIX_MAX_JOBS
- fix(runner): make nix `max-jobs` configurable via `DEVCELL_NIX_MAX_JOBS` env var (default `auto`) — CI can cap concurrent nix builds to stay within runner memory limits without affecting local dev - fix(runner): forward `DEVCELL_NIX_MAX_JOBS` into the thin-build docker container via `-e` — env var now reaches the nix.conf inside the builder - fix(ci): set `DEVCELL_NIX_MAX_JOBS=2` on both thin build steps — ultimate stack no longer exhausts 8 GB Blacksmith runner memory during home-manager switch - test(runner): update `TestThinBuildArgv_NixConfDaemonMode` to match new `DEVCELL_NIX_MAX_JOBS:-auto` pattern — no behavior change
1 parent 0847740 commit 2e17aa2

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎.github/workflows/build.dev.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ jobs:
164164
env:
165165
DEVCELL_NIX_VOLUME: devcell-nix-store-${{ matrix.arch }}
166166
DEVCELL_NIXHOME_PATH: ${{ github.workspace }}/nixhome
167+
DEVCELL_NIX_MAX_JOBS: "2"
167168
run: |
168169
BASE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:v0.0.0-${{ matrix.arch }}-base"
169170
./bin/cell build --thin --stack base --image "$BASE_TAG" --debug
@@ -188,6 +189,7 @@ jobs:
188189
env:
189190
DEVCELL_NIX_VOLUME: devcell-nix-store-${{ matrix.arch }}
190191
DEVCELL_NIXHOME_PATH: ${{ github.workspace }}/nixhome
192+
DEVCELL_NIX_MAX_JOBS: "2"
191193
run: |
192194
ULT_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:v0.0.0-${{ matrix.arch }}-ultimate"
193195
./bin/cell build --thin --stack ultimate --image "$ULT_TAG" --debug

‎internal/runner/thin_build.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ experimental-features = nix-command flakes
106106
# 16 is the upstream default; stays under the CDN's throttle threshold.
107107
max-substitution-jobs = 16
108108
http-connections = 16
109-
max-jobs = auto
109+
max-jobs = ''${DEVCELL_NIX_MAX_JOBS:-auto}
110110
sandbox = true
111111
ssl-cert-file = $CACERT
112112
NIXCONF
@@ -351,6 +351,9 @@ echo "Done — thin image: %s"`,
351351
if !remote {
352352
args = append(args, "-v", nixhomeRef+":/opt/nixhome")
353353
}
354+
if v := os.Getenv("DEVCELL_NIX_MAX_JOBS"); v != "" {
355+
args = append(args, "-e", "DEVCELL_NIX_MAX_JOBS="+v)
356+
}
354357
args = append(args,
355358
"-v", "/var/run/docker.sock:/var/run/docker.sock",
356359
"--entrypoint", "sh",

‎internal/runner/thin_build_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ func TestThinBuildArgv_NixConfDaemonMode(t *testing.T) {
137137
if !strings.Contains(script, "sandbox = true") {
138138
t.Error("should set sandbox = true (isolate builds)")
139139
}
140-
if !strings.Contains(script, "max-jobs = auto") {
141-
t.Error("should set max-jobs = auto (parallel builds under daemon)")
140+
if !strings.Contains(script, "DEVCELL_NIX_MAX_JOBS:-auto") {
141+
t.Error("should set max-jobs from DEVCELL_NIX_MAX_JOBS (default auto)")
142142
}
143143
if !strings.Contains(script, "nix-daemon") {
144144
t.Error("should start nix-daemon (avoids /homeless-shelter race)")

0 commit comments

Comments
 (0)