Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 691b284

Browse files
authored
Use nixbuild.net as a remote nix builder on CI (#81)
GitHub Actions Runners only have 7GB of memory which is proving to be too small to built ic-hs. So instead of building nix derivations on a runner locally we configure the runner to build derivations remotely on nixbuild.net. The above requires access to a private SSH key, which is used to authenticate with nixbuild.net. This key is not accessible on PRs originating from forks because that would allow leaking the key. For those PRs we don't configure nixbuild.net as a remote builder and build locally instead.
1 parent b7bbd5d commit 691b284

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,40 @@ jobs:
1111
matrix:
1212
os:
1313
- ubuntu-latest
14-
- macos-latest
15-
# TODO: - windows-latest
14+
15+
# TODO: nixbuild.net currently does not have x86_64-darwin nor aarch64-darwin support but they're working on it:
16+
#
17+
# | I do have another question: do you support x86_64-darwin builds and
18+
# | ideally aarch64-darwin as well (I just got a new M1 MacBook)?
19+
#
20+
# Our long-term goal is to support x86_64-darwin and aarch64-darwin, but
21+
# we don't do it today. The reason is that we really like all builds to
22+
# run inside our virtualized sandbox (with our own virtual file system),
23+
# since it gives us full control and also lots of insights about the
24+
# builds. We have not yet ported this sandbox to MacOS, but it is
25+
# definitely something we want to do.
26+
#
27+
# We actually _have_ aarch64-darwin machines in our build cluster,
28+
# running build sandboxes for aarch64-linux. We use a mix of Hetzner
29+
# instances (https://www.hetzner.com/dedicated-rootserver/mac-mini-m1)
30+
# and self-hosted M1 machines for this. The aarch64-linux support is EA
31+
# in nixbuild.net, so we are still experimenting a bit.
32+
#
33+
# - macos-latest
1634
fail-fast: false
1735
runs-on: ${{ matrix.os }}
36+
env:
37+
SSH_KEY_FOR_NIXBUILD: secrets.SSH_KEY_FOR_NIXBUILD
1838
steps:
1939
- uses: actions/checkout@v2
20-
- uses: cachix/install-nix-action@v16
40+
- uses: nixbuild/nix-quick-install-action@v13
41+
with:
42+
nix_conf: experimental-features = nix-command
43+
- name: Configure Nix to use nixbuild.net as a remote builder
44+
if: env.SSH_KEY_FOR_NIXBUILD != ''
45+
uses: nixbuild/nixbuild-action@v10
2146
with:
22-
extra_nix_config: |
23-
experimental-features = nix-command
47+
nixbuild_ssh_key: ${{ secrets.SSH_KEY_FOR_NIXBUILD }}
2448
- run: nix-env -iA nix-build-uncached -f nix/
2549
- uses: cachix/cachix-action@v10
2650
with:
@@ -55,7 +79,10 @@ jobs:
5579
runs-on: ${{ matrix.os }}
5680
steps:
5781
- uses: actions/checkout@v2
58-
- uses: cachix/install-nix-action@v16
82+
- uses: nixbuild/nix-quick-install-action@v13
83+
- uses: nixbuild/nixbuild-action@v10
84+
with:
85+
nixbuild_ssh_key: ${{ secrets.SSH_KEY_FOR_NIXBUILD }}
5986
- uses: cachix/cachix-action@v10
6087
with:
6188
name: ic-hs-test

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ It’s necessary to wrap all lines with the `r $ …` for now; this sets the
190190
endpoint parameter.
191191

192192

193+
Continuous Integration
194+
----------------------
195+
196+
We use GitHub Actions to trigger builds of the jobs defined in `./default.nix`. However the builds themselves are run on the [nixbuild.net](https://nixbuild.net/) service since it provides more capacity and is more efficient than GitHub runners.
197+
198+
Please use the artifacts produced by GitHub Actions and nixbuild.net at your own risk or consider building independently from source.
199+
200+
193201
Running
194202
-------
195203

0 commit comments

Comments
 (0)