forked from Gerschtli/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (148 loc) · 5.23 KB
/
ci.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Build and test flake outputs
on:
push:
workflow_dispatch:
workflow_call:
inputs:
branch:
description: Branch name to build on
default: ""
required: false
type: string
secrets:
CACHIX_AUTH_TOKEN:
required: true
jobs:
nix:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
system:
- aarch64
- x86_64
nix-command:
- fmt -- --check
- eval .#apps.$_system.nixos-shell.program
- eval .#apps.$_system.setup.program
- develop .#ruby --impure
- develop .#deno --impure
- develop .#jvmlanguages-devenv --impure
- develop .#ocaml --impure
- develop .#rust --impure
- develop .#haskell --impure
- develop .#playwright --impure
- develop .#machnix --impure
- develop .#jupyenv --impure
- develop .#nixd
- eval .#apps.$_system.jupyenv-app.program
include:
- nix-command: build .#homeConfigurations."dani@maiziedemacchiato".activationPackage
system: x86_64
- nix-command: build --log-lines 9999 .#nixOnDroidConfigurations.sams9.activationPackage --impure --print-build-logs
system: aarch64
- nix-command: build .#nixosConfigurations.DANIELKNB1.config.system.build.toplevel
system: x86_64
- nix-command: build .#packages.$_system.installer-image
system: x86_64
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
continue-on-error: true
with:
tool-cache: true
- name: Install nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
keep-going = true
show-trace = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Setup cachix
uses: cachix/cachix-action@v12
with:
name: 573-bc
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build command (aarch64)
if: matrix.system == 'aarch64'
# FIXME: use upstream once --tty is removed
#uses: uraimo/run-on-arch-action@v2
uses: Gerschtli/run-on-arch-action@tty
with:
arch: aarch64
distro: alpine_latest
dockerRunArgs: --volume /nix:/nix
install: |
apk --no-cache add curl git xz
adduser --disabled-password ci
env: |
_system: ${{ matrix.system }}-linux
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
run: |
set -euo pipefail
mkdir -p /home/ci/.config/nix
cat <<EOF > /home/ci/.config/nix/nix.conf
experimental-features = nix-command flakes
keep-going = true
show-trace = true
EOF
chown --recursive ci:ci /nix /home/ci
chgrp --recursive ci "$(pwd)"
chmod -R g+w "$(pwd)"
echo "::group::Install nix"
curl \
--silent \
--show-error \
--output /tmp/install \
--retry 5 \
--retry-all-errors \
--fail \
--location \
"https://nixos.org/nix/install"
# "https://releases.nixos.org/nix/nix-2.14.1/install"
su ci -c "sh /tmp/install --no-channel-add --no-daemon"
rm /tmp/install
function run() {
su ci -c ". /home/ci/.nix-profile/etc/profile.d/nix.sh; $*"
}
# FIXME: setting build-hook is needed because default hook `nix __build-remote` is not available - NixOS/nix#7217
function build_hook() {
local nix_path="$(run which nix)"
echo "${nix_path/bin\/nix/libexec/nix/build-remote}"
}
run echo "build-hook = $(build_hook)" >> /home/ci/.config/nix/nix.conf
echo "::group::Setup cachix"
run nix-env --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
run cachix --version
run cachix use gerschtli
run cachix use nix-on-droid
run cachix use 573-bc
run cachix use nix-community
run cachix use tweag-jupyter
run cachix use coq
run cachix use nixpkgs-ruby
echo "::group::Build command"
run git config --global --add safe.directory "$(pwd)"
# TODO where is run needed
run cachix watch-exec 573-bc \
nix -- ${{ matrix.nix-command }}
- name: Build command (x86_64)
if: matrix.system == 'x86_64'
env:
_system: ${{ matrix.system }}-linux
run: |
cachix use gerschtli
cachix use nix-on-droid
cachix use 573-bc
cachix use nix-community
cachix use tweag-jupyter
cachix use coq
cachix use nixpkgs-ruby
echo "::group::Build command"
cachix watch-exec 573-bc \
nix -- ${{ matrix.nix-command }}
# vim: set sw=2: