-
Notifications
You must be signed in to change notification settings - Fork 1
206 lines (195 loc) · 6.36 KB
/
nix-large-packages.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Build large nix packages
on:
workflow_dispatch:
inputs:
branch:
description: "which branch to checkout"
required: false
type: string
update-nix-inputs:
description: "update nix inputs"
type: boolean
default: false
required: false
build-experimental-packages:
description: "build experimental packages"
type: boolean
default: true
required: false
workflow_call:
inputs:
branch:
description: "which branch to checkout"
required: false
type: string
update-nix-inputs:
description: "update nix inputs"
type: boolean
default: false
required: false
build-experimental-packages:
description: "build experimental packages"
type: boolean
default: true
required: false
pull_request:
branches:
- master
- main
- actions
- ci
- "releases/*"
paths:
- "*.nix"
- "**/*.nix"
- "nix/**"
- "flake.lock"
push:
branches:
- master
- main
- actions
- ci
- "releases/*"
paths:
- ".github/workflows/nix.yml"
- "*.nix"
- "**/*.nix"
- "nix/**"
- "flake.lock"
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
include:
- type: "expression"
# TODO: any better way to build overrided virtualbox derivation?
data: |
with (builtins.getFlake (builtins.toString ./.));
let
systemPackages = nixosConfigurations.maximal-x86_64-linux.config.environment.systemPackages;
packages = builtins.filter (p: builtins.match "virtualbox-.*" p.name != null) systemPackages;
package = builtins.elemAt packages 0;
in package
experimental: true
- type: "expression"
data: |
with (builtins.getFlake (builtins.toString ./.)); packages.x86_64-linux.dvm
experimental: true
- type: "nixosConfiguration"
data: "mdq"
experimental: true
free-disk-space: true
- type: "package"
data: "config.boot.kernelPackages.kernel"
experimental: false
- type: "package"
data: "pkgs.clojure-lsp"
experimental: false
- type: "package"
data: "pkgs.keepassxc"
experimental: false
- type: "package"
data: "pkgs.calibre"
experimental: false
- type: "package"
data: "pkgs.clash-verge"
experimental: false
- type: "package"
data: "pkgs.texlab"
experimental: false
- type: "package"
data: "pkgs.llvmPackages_latest.llvm"
experimental: false
- type: "package"
data: "pkgs.myPackages.emacs"
experimental: false
- type: "package"
data: "pkgs.myPackages.texLive"
experimental: false
- type: "arguments"
data: |
.#caddy
experimental: true
steps:
- name: Set up common variables
id: variables
env:
DATA: ${{ matrix.data }}
run: |
set -xeuo pipefail
set_output() {
for v in "$@"; do
echo "$v=${!v}" >> $GITHUB_OUTPUT
done
}
system=${{ matrix.system }}
system="${system:-x86_64-linux}"
freeDiskSpace=${{ matrix.free-disk-space }}
freeDiskSpace="${freeDiskSpace:-false}"
shouldSkip=false
if [[ "${{ format('{0}', !inputs.build-experimental-packages && matrix.experimental) }}" == 'true' ]]; then
shouldSkip=true
fi
case '${{ github.event_name }}' in
'push')
if printf '%s\0' "x86_64-linux" "aarch64-linux" | grep -Fxz -- "${{ github.ref_name }}" && [[ "${{ github.ref_name }}" != "${system}" ]]; then
shouldSkip=true
fi
;;
*)
:
;;
esac
nixExpressionBase64=
nixArguments=
case '${{ matrix.type }}' in
'expression')
nixExpressionBase64="$(base64 -w 0 <<< "$DATA")"
;;
'package')
nixExpressionBase64="$(base64 -w 0 <<< "with (builtins.getFlake (builtins.toString ./.)); nixosConfigurations.maximal-${system}.${{ matrix.data }}")"
;;
'nixosConfiguration')
nixExpressionBase64="$(base64 -w 0 <<< 'with (builtins.getFlake (builtins.toString ./.)); nixosConfigurations.${{ matrix.data }}.config.system.build.toplevel')"
;;
'arguments')
nixArguments="${{ matrix.data }}"
;;
*)
exit 1
;;
esac
set_output system freeDiskSpace shouldSkip nixExpressionBase64 nixArguments
- name: Checkout repository
if: steps.variables.outputs.shouldSkip != 'true'
uses: actions/checkout@v4
with:
ref: "${{ inputs.branch || '' }}"
submodules: true
- name: Setup nix
if: steps.variables.outputs.shouldSkip != 'true'
uses: ./
with:
setup-cachix: true
cachix-auth-token: "${{ secrets.CACHIX_AUTH_TOKEN }}"
setup-qemu: true
free-disk-space: ${{ steps.variables.outputs.freeDiskSpace }}
nix-systems: "${{ steps.variables.outputs.system }}"
- name: Update nix flake inputs
if: format('{0}', inputs.update-nix-inputs) == 'true'
run: |
nix flake update
- name: Build the package
if: steps.variables.outputs.shouldSkip != 'true'
run: |
if [[ -n "${{ steps.variables.outputs.nixExpressionBase64 }}" ]]; then
base64 -d <<< "${{ steps.variables.outputs.nixExpressionBase64 }}" | tee temp.nix
nix build -f temp.nix
fi
if [[ -n "${{ steps.variables.outputs.nixArguments }}" ]]; then
nix build ${{ steps.variables.outputs.nixArguments }}
fi