-
Notifications
You must be signed in to change notification settings - Fork 54
80 lines (67 loc) · 2.38 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build
on:
pull_request:
push:
jobs:
matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/[email protected]
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Generate matrix
id: set-matrix
run: |
set -Eeu
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
build:
needs: matrix
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.matrix.outputs.matrix)}}
steps:
# Why are we doing this?
#
# The hosted GitHub runners have free disk space split
# between the root partition and a temporary partition,
# leaving limited space for builds. We work around this
# with easimon/maximize-build-space which creates a LVM
# volume to combine the free space in both.
#
# We mount this new volume at /nix, and set TMPDIR so
# all builds happen inside the volume.
- name: Create mount point for Nix store
run: |
sudo mkdir /nix
- name: Maximize disk space for builds
uses: easimon/maximize-build-space@v7
with:
build-mount-path: /nix
- name: Set Nix store ownership
run: |
sudo chown root:root /nix
- uses: actions/[email protected]
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Override nix-daemon build directory
run: |
sudo mkdir -p /nix/tmp
sudo chmod ug=rwx,o=rwxt /nix/tmp
sudo mkdir -p /etc/systemd/system/nix-daemon.service.d
sudo tee /etc/systemd/system/nix-daemon.service.d/override.conf >/dev/null <<EOF
[Service]
Environment=TMPDIR=/nix/tmp
EOF
sudo systemctl daemon-reload
sudo systemctl restart nix-daemon
- name: Setup automatic caching
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Install nix-build-uncached
# Save evaluation time by pulling directly from cache.nixos.org
# nixpkgs rev 12303c652b881435065a98729eb7278313041e49
run: nix-env -i /nix/store/npzpwxjbxlgbi0kfji2x44nssksxk4zw-nix-build-uncached-1.1.2
- run: nix-build-uncached .ci/get-flake.nix -A "${{ matrix.attr }}"