-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathaction.yml
75 lines (71 loc) · 2.91 KB
/
action.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
name: Install GNU Guix
description: Add GNU guix package manager to GitHub Action runner.
branding:
icon: 'package'
color: 'gray-dark'
inputs:
channels:
description: 'Guix channel description as Scheme code'
required: false
# Use the GitHub mirror to decrease load on Savannah.
default: |-
%default-channels
pullAfterInstall:
description: 'Run `guix pull` after installing Guix'
required: false
default: true
outputs:
channels:
description: 'Exact Guix channels that were used for this action.'
value: ${{ steps.guix-describe.outputs.channels }}
runs:
using: 'composite'
steps:
# The default locale on Debian and Ubuntu is "C.UTF-8" which does not exist
# in vanilla glibc. Change to something that works for Guix and Debuntu.
- run: echo LANG=en_US.utf8 >> $GITHUB_ENV
shell: bash
name: Set LANG
- run: |
wget -nv https://ci.guix.gnu.org/search/latest/archive?query=spec:tarball+status:success+system:x86_64-linux+guix-binary.tar.xz -O guix-binary-nightly.x86_64-linux.tar.xz
shell: bash
name: Download
- run: |
sudo -- tar --extract --file "guix-binary-nightly.x86_64-linux.tar.xz" -C / --no-overwrite-dir
sudo -- groupadd --system guixbuild
for i in $(seq -w 1 10); do
sudo useradd -g guixbuild -G guixbuild -d /var/empty -s "$(which nologin)" -c "Guix build user $i" --system "guixbuilder${i}"
done
export GUIX_PATH=/var/guix/profiles/per-user/root/current-guix
sudo cp $GUIX_PATH/lib/systemd/system/{gnu-store.mount,guix-daemon.service} /etc/systemd/system/
sudo chmod 664 /etc/systemd/system/{gnu-store.mount,guix-daemon.service}
sudo systemctl daemon-reload
sudo systemctl enable --now gnu-store.mount guix-daemon.service
echo "$GUIX_PATH/bin" >> $GITHUB_PATH
shell: bash
name: Install Guix
- name: Authorize build farm
shell: bash
run: |
for F in /var/guix/profiles/per-user/root/current-guix/share/guix/*.pub; do
sudo /var/guix/profiles/per-user/root/current-guix/bin/guix archive --authorize < $F
done
- run: sudo /var/guix/profiles/per-user/root/current-guix/bin/guix archive --generate-key
shell: bash
name: Generate keys
- run: |
cat <<EOF > ${{ runner.temp }}/channels.scm
${{ inputs.channels }}
EOF
shell: bash
name: Create channel file
- run: sudo /var/guix/profiles/per-user/root/current-guix/bin/guix pull --fallback -C ${{ runner.temp }}/channels.scm
shell: bash
name: Update Guix
if: ${{ inputs.pullAfterInstall == 'true' }}
# Substitute newlines to work-around GitHubs single-line limitation.
- run: |
echo "channels=$(/var/guix/profiles/per-user/root/current-guix/bin/guix describe -f channels | tr '\n' ' ')" >> $GITHUB_OUTPUT
shell: bash
name: guix describe
id: guix-describe