# Nothing but Nix - reclaim 130GB for Nix in GitHub runners

**URL:** https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345
**Category:** Announcements
**Created:** [May 16, 2025, 2:50pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345 "2025-05-16T14:50:45Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Wimpy](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/wimpy/32/32295_2.png) [@Wimpy](https://discourse.nixosstag.fcio.net/u/Wimpy)
#### Post date: [May 16, 2025, 2:50pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/1 "2025-05-16T14:50:46Z")

</div>

# Nothing but Nix

Here’s a tool I’ve created that might help those who build complex NixOS configurations in GitHub CI.

## The problem

Standard GitHub Actions runners have only ~20GB of free disk space, _or so they would have you believe_. If you’ve tried to build sophisticated NixOS or Home Manager configurations in CI, you might have encountered _“no space left on device”_ error. A comprehensive workstation or server setup can consume 10-15GB, leaving precious little headroom 🤏

This space limitation meant I couldn’t build my full configurations in CI, preventing me from properly caching complete builds. Each change to my workstations and servers required frustrating additional compilation time for things like 3rd party kernel modules, Ollama, custom package overrides, and more 😞

## The solution: Nothing but Nix 🪓❄

[**Nothing but Nix**](https://github.com/marketplace/actions/nothing-but-nix) is a GitHub Action that transforms standard GitHub runners from ~20GB spaces into 65-130GB Nix powerhouses 💪

Here’s how it works:

1. **Initial Volume Creation** : Creates a large BTRFS volume from free space on `/mnt`
2. **Background Purge** : Ruthlessly eliminates unnecessary software to reclaim even more space, _ **while your workflow runs** _
3. **Dynamic Growth** : Expands your Nix volume as space becomes available

## Technical implementation

The action uses loop devices with sparse files and a BTRFS filesystem:

```bash
# Create a large disk image in the free space
free_space=$(df -m --output=avail /mnt | tail -n 1 | tr -d ' ')
loop_dev=$(sudo losetup --find)
sudo fallocate -l $((free_space - 1024))M "/mnt/disk0.img"
sudo losetup "${loop_dev}" "/mnt/disk0.img"

# Set up an optimized BTRFS filesystem
sudo mkfs.btrfs -L nix -d raid0 -m raid0 --nodiscard "${loop_dev}"
sudo mount LABEL=nix /nix -o noatime,nobarrier,nodiscard,compress=zstd:1,space_cache=v2,commit=120

```

The `nodiscard` mount option is essential to prevent misreported allocation sizes when using loop devices backed by sparse files.

I’ve written [**The Nix Space Heist: Reclaiming 130GB in GitHub Actions**](https://wimpysworld.com/posts/nothing-but-nix-github-actions/) blog post that goes into more detail 🤓

## Usage 🔧

This action requires that it runs before Nix is installed. Add it before your Nix installation like so:

```yaml
- uses: actions/checkout@v4
- uses: wimpysworld/nothing-but-nix@main
- uses: DeterminateSystems/nix-installer-action@main
- run: nix flake check

```

Would love to hear from others who try it out or have alternative approaches to this problem! 👂

- [Nothing but Nix · Actions · GitHub Marketplace · GitHub](https://github.com/marketplace/actions/nothing-but-nix)
- [GitHub - wimpysworld/nothing-but-nix: Create a 130GB Nix ️store in GitHub runners ❄️ Multi-partition BTRFS RAID-0 for /nix 💪 Brutally purges unnecessary software 🪓 Dynamically grows the Nix store 📈 · GitHub](https://github.com/wimpysworld/nothing-but-nix)

---

<div class="post-metadata">

### Author: ![imincik](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/i/6de8d8/32.png) [@imincik](https://discourse.nixosstag.fcio.net/u/imincik)
#### Post date: [May 16, 2025, 3:16pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/2 "2025-05-16T15:16:15Z")

</div>

Great work !

What I do so far is

```auto
      - name: Get more storage space
        run: |
          sudo df -h
          sudo rm -rf /usr/share/dotnet
          sudo rm -rf /usr/local
          sudo rm -rf /opt
          sudo df -h

```

which gives me quickly 20GB, but your solutions is much smarter 🙂

---

<div class="post-metadata">

### Author: ![Wimpy](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/wimpy/32/32295_2.png) [@Wimpy](https://discourse.nixosstag.fcio.net/u/Wimpy)
#### Post date: [May 16, 2025, 3:20pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/3 "2025-05-16T15:20:56Z")

</div>

If you use:

```yaml
- uses: wimpysworld/nothing-but-nix@main
  with:
    hatchet-protocol: 'holster'

```

You’ll get a 65GB `/nix` volume in 1 second ⏱ with no additional purging required 🙂

---

<div class="post-metadata">

### Author: ![dtomvan](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/dtomvan/32/31095_2.png) [@dtomvan](https://discourse.nixosstag.fcio.net/u/dtomvan)
#### Post date: [May 16, 2025, 3:27pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/4 "2025-05-16T15:27:11Z")

</div>

That’s so creative! Is it reliable? Even more savings if zstd compressed??

---

<div class="post-metadata">

### Author: ![Wimpy](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/wimpy/32/32295_2.png) [@Wimpy](https://discourse.nixosstag.fcio.net/u/Wimpy)
#### Post date: [May 16, 2025, 3:36pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/5 "2025-05-16T15:36:13Z")

</div>

I’ve been testing it for the last few days. In short, yes. I think it is reliable, and if you use `hatchet-protocol: 'holster'` to side step the rampant butchering 🪓 of the underlying Ubuntu host, it reduces the risk of incident significantly 🙂

While testing, I encountered issues 🐛 and had to work through them, _see the commit history_ 😁 But I’m pretty confident it’s in a good place now. zstd might offer a benefit when using the lower yield purge strategies.

---

<div class="post-metadata">

### Author: ![NobbZ](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/nobbz/32/7022_2.png) [@NobbZ](https://discourse.nixosstag.fcio.net/u/NobbZ)
#### Post date: [May 16, 2025, 3:54pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/6 "2025-05-16T15:54:21Z")

</div>

I’m using `easimon/maximize-build-space@master` for years now, are you able to provide more space?

Are you doing it generally different?

Can you give me an elevator pitch why I should use yours over another solution?

---

<div class="post-metadata">

### Author: ![Wimpy](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/wimpy/32/32295_2.png) [@Wimpy](https://discourse.nixosstag.fcio.net/u/Wimpy)
#### Post date: [May 16, 2025, 4:55pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/7 "2025-05-16T16:55:46Z")

</div>

Thanks for your question about Nothing but Nix compared to [`easimon/maximize-build-space`](https://github.com/easimon/maximize-build-space). Here’s where Nothing but Nix stands out:

> [@NobbZ](#):
>
> I’m using `easimon/maximize-build-space@master` for years now, are you able to provide more space?

Nothing but Nix can provide significantly more usable space:

- Up to **130GB** for your Nix store (with Rampage protocol)
- Versus a maximum of ~95GB from `maximize-build-space`

> [@NobbZ](#):
>
> Are you doing it generally different?

Yes 🙂

While both actions create additional storage, Nothing but Nix features:

1. **Nix-specific optimization** : Designed from the ground up for Nix workflows, not as a general-purpose solution
  - Specifically engineered to squeeze out every byte for `/nix`

2. **Two-phase approach** :
  - Immediate volume creation ( **~65GB in 1 second** ), a size `maximize-build-space` can only reach after a significant blocking period while it purges files with `rm`.
  - Background expansion (up to ~130GB total)

3. **Background processing** : Purging happens without blocking workflow execution
  - Background purging continues while your workflow runs, rather than blocking it

4. **Reduces CI time:** Uses `rmz` (from [Fast Unix Commands](https://github.com/SUPERCILEX/fuc)), which outperforms standard `rm` by an order of magnitude
  - Parallel-processes deletions for maximum efficiency

> [@NobbZ](#):
>
> Can you give me an elevator pitch why I should use yours over another solution?

## Elevator Pitch 🚀

_“Nothing but Nix provides up to 130GB of purpose-built Nix storage by aggressively reclaiming space without delaying your workflow. It’s not just more space - it’s faster space immediately available while background optimizations continue working for you.”_

While `maximize-build-space` is still deleting files, your **Nothing but Nix** powered workflow has already finished 🏁🏆

---

<div class="post-metadata">

### Author: ![dtomvan](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/dtomvan/32/31095_2.png) [@dtomvan](https://discourse.nixosstag.fcio.net/u/dtomvan)
#### Post date: [May 16, 2025, 5:20pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/8 "2025-05-16T17:20:02Z")

</div>

Did you just write that with AI??

---

<div class="post-metadata">

### Author: ![Wimpy](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/wimpy/32/32295_2.png) [@Wimpy](https://discourse.nixosstag.fcio.net/u/Wimpy)
#### Post date: [May 16, 2025, 8:51pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/9 "2025-05-16T20:51:25Z")

</div>

No. I looked through the `action.yml` from `maximize-build-space` and worked out how it differed from Nothing but Nix and reused some of the documentation I’ve already written in the reply.

---

<div class="post-metadata">

### Author: ![dtomvan](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/dtomvan/32/31095_2.png) [@dtomvan](https://discourse.nixosstag.fcio.net/u/dtomvan)
#### Post date: [May 16, 2025, 9:09pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/10 "2025-05-16T21:09:58Z")

</div>

Hmm. I guess your reply to my initial comment sounded more human to me than that longer one about the differences to `maximize-build-space`

Especially this part:

> [@Wimpy](#):
>
> While `maximize-build-space` is still deleting files, your **Nothing but Nix** powered workflow has already finished 🏁🏆

… Sorry for coming across rude.

---

<div class="post-metadata">

### Author: ![purepani](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/purepani/32/10105_2.png) [@purepani](https://discourse.nixosstag.fcio.net/u/purepani)
#### Post date: [May 19, 2025, 6:34am UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/11 "2025-05-19T06:34:01Z")

</div>

The action looks really cool and I’m definitely likely to try this out in the future. I’ve been thinking about using GA for nix CI for my config, but I always was worried about the 20GB limit for it. This will fix that problem.

Some feedback on the blog post: the constant use of emojis everywhere is extremely distracting and made it harder to read through for me than a normal blog post. They tend to have bright colors, and especially when placed in the middle of text, make it really hard for me to focus on actually reading without my eyes snapping to the emojis. Otherwise, I thought it was a good and informative blog post.

---

<div class="post-metadata">

### Author: ![aanderse](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/aanderse/32/1420_2.png) [@aanderse](https://discourse.nixosstag.fcio.net/u/aanderse)
#### Post date: [June 27, 2025, 2:38am UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/12 "2025-06-27T02:38:54Z")

</div>

> [@Wimpy](#):
>
> Would love to hear from others who try it out

thanks for posting this

i tried it out tonight and ran into an error when executing the `update-flake-lock` action:

```auto
Run node "$GITHUB_ACTION_PATH/dist/index.js"
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/87b0c4a6-315e-4fd1-852f-11c5e08f1b99.sh
/home/runner/work/_temp/87b0c4a6-315e-4fd1-852f-11c5e08f1b99.sh: line 1: node: command not found
Error: Process completed with exit code 127.

```

maybe i am missing something obvious… here is part of my workflow:

```auto
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: checkout repository
        uses: actions/checkout@v4

      - name: free up disk space
        uses: wimpysworld/nothing-but-nix@main

      - name: install nix
        uses: cachix/install-nix-action@v31
        with:
          nix_path: nixpkgs=channel:nixos-unstable
          extra_nix_config: |
            experimental-features = nix-command flakes pipe-operators

      - name: update flake.lock and open a pull request
        uses: DeterminateSystems/update-flake-lock@v25
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          pr-title: "chore: update flake.lock"
          pr-body: "automated update of flake inputs"
          commit-msg: "chore: update flake.lock"

```

have you seen anything like this before? any and all help is greatly appreciated 🙇‍♂️

---

<div class="post-metadata">

### Author: ![terlar](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/terlar/32/868_2.png) [@terlar](https://discourse.nixosstag.fcio.net/u/terlar)
#### Post date: [July 23, 2025, 8:21pm UTC](https://discourse.nixosstag.fcio.net/t/nothing-but-nix-reclaim-130gb-for-nix-in-github-runners/64345/13 "2025-07-23T20:21:26Z")

</div>

Since it removes all those runtime stuff, actions that depend on such things won’t work. I guess you could have something that adds node back via nix, perhaps that could work.

Personally I used [GitHub - jlumbroso/free-disk-space: :octocat:⚙️🗑️ A GitHub Action to free disk space on an Ubuntu runner.](https://github.com/jlumbroso/free-disk-space)

Keeping the tool cache (incl node) is about 6GB

You could also split your jobs into multiple parts and don’t do the cleanup in jobs that use node based actions
