From 3dbe9fb218f2805fede7949a3fea0291bf960038 Mon Sep 17 00:00:00 2001 From: Niklas Zender Date: Mon, 3 Aug 2026 23:45:14 +0200 Subject: [PATCH] fix(ci): make room on the runner before building A GitHub runner has around 20 GB free, and a devshell that brings a Flutter SDK and two Rust toolchains does not fit beside the languages GitHub preinstalls. Builds die halfway through with "No space left on device". Deleting them wholesale is safe here for the same reason there is no setup action in these workflows: the toolchain comes from the devshell. Signed-off-by: Niklas Zender Co-authored-by: Cursor --- .github/workflows/check-pre-commit-hooks.yml | 5 +++ nix/general/workflows/ci-steps.nix | 32 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-pre-commit-hooks.yml b/.github/workflows/check-pre-commit-hooks.yml index 132843d2..480179f5 100644 --- a/.github/workflows/check-pre-commit-hooks.yml +++ b/.github/workflows/check-pre-commit-hooks.yml @@ -7,6 +7,11 @@ jobs: prek: runs-on: ubuntu-latest steps: + - name: Free up disk space + run: | + sudo rm -rf /usr/share/dotnet /usr/share/swift /usr/local/lib/android \ + /opt/ghc /opt/hostedtoolcache + df -h / - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 - uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 - env: diff --git a/nix/general/workflows/ci-steps.nix b/nix/general/workflows/ci-steps.nix index ff07a050..0109d308 100644 --- a/nix/general/workflows/ci-steps.nix +++ b/nix/general/workflows/ci-steps.nix @@ -46,10 +46,25 @@ in readOnly = true; }; + freeDiskSpace = lib.mkOption { + description = '' + Delete the language toolchains GitHub preinstalls on its runners. + + A runner has around 20 GB free, and a devshell that brings a Flutter + SDK and two Rust toolchains does not fit beside all of that. Builds + fail with "No space left on device" halfway through. + + Nothing of ours uses any of it: our toolchain comes from the + devshell, which is the reason we can throw it away wholesale. + ''; + type = lib.types.listOf lib.types.attrs; + readOnly = true; + }; + setup = lib.mkOption { description = '' - The steps every workflow of ours starts with: check out the - repository and install nix. + The steps every workflow of ours starts with: make room on the + runner, check out the repository and install nix. Since the toolchain comes from the devshell, there is deliberately no language-specific setup action here. @@ -112,7 +127,18 @@ in checkout = [ { uses = allowed-actions."actions/checkout".uses; } ]; installNix = [ { uses = allowed-actions."cachix/install-nix-action".uses; } ]; - setup = steps.checkout ++ steps.installNix; + freeDiskSpace = [ + { + name = "Free up disk space"; + run = '' + sudo rm -rf /usr/share/dotnet /usr/share/swift /usr/local/lib/android \ + /opt/ghc /opt/hostedtoolcache + df -h / + ''; + } + ]; + + setup = steps.freeDiskSpace ++ steps.checkout ++ steps.installNix; privateDependencies = [ {