Skip to content

fix(ci): free more disk space and add nix fallback for cache mismatches - #1929

Merged
shunkakinoki merged 1 commit into
mainfrom
fix/ci-disk-space-and-nix-fallback
Jun 19, 2026
Merged

fix(ci): free more disk space and add nix fallback for cache mismatches#1929
shunkakinoki merged 1 commit into
mainfrom
fix/ci-disk-space-and-nix-fallback

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enable tool-cache: true and explicit category flags in free-disk-space action for both E2E and Docker workflows to reclaim ~5GB additional disk space (fixes No space left on device during nix build on Ubuntu)
  • Add --fallback to NIX_FLAGS in Makefile and fallback = true to nix.conf in Dockerfile and E2E workflow, so nix builds from source when binary cache returns hash mismatches (fixes arm64 Docker build failure: hash mismatch importing path .../cyrus-sasl-2.1.28-dev)

Test plan

  • E2E (Ubuntu) job completes without disk space exhaustion
  • Docker (linux/arm64) job completes without nix cache hash mismatch errors
  • E2E (MacOS) and E2E (NixOS) jobs remain green
  • Docker (linux/amd64) job remains green

🤖 Generated with Claude Code


Summary by cubic

Free up more disk space on Linux runners and add Nix fallback to fix CI build failures. This prevents “No space left on device” and handles cache hash mismatches, stabilizing E2E and Docker builds (including linux/arm64).

  • Bug Fixes
    • E2E and Docker workflows: enable tool-cache: true and explicit categories in jlumbroso/free-disk-space@v1.3.1 to reclaim ~5 GB.
    • Nix: set fallback = true in nix.conf (Dockerfile and E2E) and add --fallback to NIX_FLAGS in the Makefile so builds continue from source on cache mismatches.

Written for commit 0bd05d8. Summary will update on new commits.

Review in cubic

@indent-zero

indent-zero Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Tightens up disk-pressure and Nix substituter-mismatch failures in CI. The free-disk-space action is now run with all opt-in flags enabled on the Docker and E2E workflows, and Nix is configured to fall back to from-source builds (via fallback = true / --fallback) in the e2e runner, the published runner image, and the Makefile. Net effect: fewer "no space left" and "hash mismatch" CI failures, at the cost of occasionally longer builds when a binary cache miss occurs.

  • .github/workflows/docker.yml: enable tool-cache, android, dotnet, haskell, large-packages, swap-storage on jlumbroso/free-disk-space@v1.3.1 (previously only tool-cache: false).
  • .github/workflows/e2e.yml: same free-disk-space toggles, plus fallback = true added to cachix/install-nix-action extra_nix_config.
  • Dockerfile: append fallback = true to /etc/nix/nix.conf written into the published runner image.
  • Makefile: append --fallback to the shared NIX_FLAGS consumed by every Nix invocation.

Issues

3 potential issues found:

  • Setting swap-storage: true removes the runner swap file, which paired with the new fallback = true (more from-source Nix builds) makes OOM kills more likely — particularly on the lower-RAM ubuntu-24.04-arm Docker runner when a heavyweight derivation (Rust, GHC, etc.) is built from source. → Autofix
  • fallback = true is now baked into /etc/nix/nix.conf of the published ghcr.io/.../dotfiles runner image, so downstream consumers running nix build inside this image will silently start building from source on cache misses instead of failing fast — worth a note in the image's README if that wasn't the intent. → Autofix
  • Adding --fallback unconditionally to NIX_FLAGS also applies to local developer machines, where a transient substituter outage or hash mismatch will silently kick off long from-source rebuilds (Rust toolchain, GHC, etc.) instead of failing fast — consider gating it behind CI/IN_DOCKER since the conditional substituter block right below already uses that pattern. → Autofix

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44969b60-0701-4d77-953f-6b3cdf25946d

📥 Commits

Reviewing files that changed from the base of the PR and between 2b575cb and 0bd05d8.

📒 Files selected for processing (4)
  • .github/workflows/docker.yml
  • .github/workflows/e2e.yml
  • Dockerfile
  • Makefile

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Updated build infrastructure configurations across CI/CD workflows and container setup to improve build reliability and system resource management.

Walkthrough

The PR expands the "Free Disk Space (Ubuntu)" GitHub Actions step in both docker.yml and e2e.yml to enable multiple additional cleanup targets. It also adds fallback = true to the Nix configuration in three places: the e2e.yml Nix setup block, the Dockerfile-generated nix.conf, and the Makefile's NIX_FLAGS.

Changes

CI Disk Cleanup and Nix Fallback

Layer / File(s) Summary
Free Disk Space expansion in CI workflows
.github/workflows/docker.yml, .github/workflows/e2e.yml
Both workflows switch the jlumbroso/free-disk-space action from minimal configuration to enabling tool-cache, android, dotnet, haskell, large-packages, and swap-storage cleanup targets.
Nix fallback option across config sites
.github/workflows/e2e.yml, Dockerfile, Makefile
Adds fallback = true to the Nix extra config block in e2e.yml, appends fallback = true after sandbox = true in the Dockerfile's generated nix.conf, and adds --fallback to NIX_FLAGS in the Makefile.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • shunkakinoki/dotfiles#321: Modifies the same "Free Disk Space (Ubuntu)" step inputs in .github/workflows/e2e.yml, including tool-cache and related cleanup targets.
  • shunkakinoki/dotfiles#324: Modifies the same "Free Disk Space (Ubuntu)" step in .github/workflows/docker.yml, toggling tool-cache and related cleanup flags.
  • shunkakinoki/dotfiles#345: Changes the same jlumbroso/free-disk-space action inputs in both docker.yml and e2e.yml, overlapping at exactly the same workflow step configuration.

Poem

🐇 Hop hop, clear the cache away,
Android, dotnet, Haskell — out you go today!
With --fallback set and disk running free,
Nix builds glide smoother, just wait and see.
More space for the rabbit to build with glee! 🌟

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-disk-space-and-nix-fallback

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shunkakinoki
shunkakinoki merged commit 6f3046a into main Jun 19, 2026
32 of 35 checks passed
@shunkakinoki
shunkakinoki deleted the fix/ci-disk-space-and-nix-fallback branch June 19, 2026 20:10

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures Nix to use the fallback option by default in both the Dockerfile and the Makefile. The reviewer points out that enabling --fallback globally in the Makefile can cause long build times in local development environments if the binary cache is unreachable, and suggests enabling it conditionally only in CI or Docker environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Makefile
fi)
NIX_ENV := $(shell . ~/.nix-profile/etc/profile.d/nix.sh 2>/dev/null || . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 2>/dev/null || command -v nix >/dev/null 2>&1 || echo "not_found")
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure --fallback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding --fallback globally to NIX_FLAGS affects local development environments. If a binary cache is temporarily unreachable or returns a hash mismatch locally, Nix will silently fall back to building packages from source. For large packages, this can cause extremely long build times and high resource consumption on developer machines.

It is safer to enable --fallback only in CI or Docker environments where automated builds need to be resilient to transient cache issues.

NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure
ifneq ($(filter true,$(CI) $(IN_DOCKER)),)
NIX_FLAGS += --fallback
endif

dotnet: true
haskell: true
large-packages: true
swap-storage: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing swap increases OOM risk under the new fallback behavior: swap-storage: true deletes the runner's swap file. Combined with the new fallback = true (in e2e.yml extra_nix_config, Dockerfile nix.conf, and --fallback in the Makefile), heavyweight derivations that would previously be fetched from a substituter may now build from source and spike RSS. Without swap, a memory spike turns directly into an OOM kill — especially on the arm64 builder (ubuntu-24.04-arm) which has less headroom than ubuntu-latest. Note this matches the previous default (swap-storage defaults to true in this action), so the explicit value isn't a behavior change on its own — it's only worth surfacing because the fallback change makes from-source builds materially more common.

Comment thread Dockerfile
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf && \
echo "filter-syscalls = false" >> /etc/nix/nix.conf && \
echo "sandbox = true" >> /etc/nix/nix.conf && \
echo "fallback = true" >> /etc/nix/nix.conf && \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image-level fallback affects downstream consumers: Adding fallback = true to /etc/nix/nix.conf persists into the published ghcr.io/.../dotfiles image, so any user who runs nix build/nix run inside the image inherits this behavior. Where they previously got an immediate error on a substituter miss (the upstream default), they will now silently build from source — potentially long jobs for things like Rust toolchains or Chromium. If the intent is only to harden CI for this repo, consider scoping the change to Makefile + the e2e workflow and leaving the image's nix.conf at defaults; if the broader behavior is intended, calling it out in the image docs would save downstream debugging.

Comment thread Makefile
fi)
NIX_ENV := $(shell . ~/.nix-profile/etc/profile.d/nix.sh 2>/dev/null || . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh 2>/dev/null || command -v nix >/dev/null 2>&1 || echo "not_found")
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure --fallback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--fallback is now applied to local dev runs too: Unlike the workflow- and image-scoped changes, this flag is global to every $(NIX_FLAGS) invocation, including a developer running make on their laptop. If a substituter is temporarily unreachable or returns a hash mismatch, Nix will silently start a from-source build (e.g., rustc, GHC, Chromium) rather than erroring — producing long, surprising builds. The conditional substituter block immediately below (ifeq ($(OS),Darwin) / else ifdef CI etc.) already demonstrates the pattern for gating; one option:

NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval --impure
ifneq ($(filter true,$(CI) $(IN_DOCKER)),)
NIX_FLAGS += --fallback
endif

This keeps the CI-resilience benefit while preserving fast-failure semantics locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant