NixOS + home-manager configs, mirrored from GitLab SaaS.
gitlab.com/andreijiroh-dev/nixops-config
nix-flake
nixos
home-manager
nixpkgs
nix-flakes
1name: Nix Flake Builds CI
2
3on:
4 schedule:
5 - cron: "30 6 * * 5"
6 push:
7 pull_request:
8
9permissions:
10 contents: write
11 actions: write
12
13jobs:
14 update-lockfile:
15 name: Update flake lockfile
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@v4
19
20 - name: Setup Deterinate Nix
21 uses: DeterminateSystems/nix-installer-action@main
22 with:
23 determinate: true
24
25 - name: Check eval and run tests
26 run: nix flake check
27 continue-on-error: true
28
29 - name: Update flake
30 run: |
31 echo ::group::Updating lockfile
32 nix flake update
33 echo ::endgroup::
34
35 echo ::group::Metadata
36 nix flake metadata
37 echo ::endgroup::
38
39 - name: Commit and push changes
40 run: |
41 git config --global user.name "RecapTimeBot"
42 git config --global user.email "recaptimebot@gmail.com"
43 git add flake.lock
44 git commit -m "chore(flake): update lockfile [skip-ci]" --signoff || echo "No changes to commit"
45 git push
46 build-iso:
47 concurrency:
48 cancel-in-progress: false
49 group: recoverykit-iso-builds
50 needs: [update-lockfile]
51 name: Build custom Live CD ISO
52 runs-on: ubuntu-latest
53 steps:
54 - uses: actions/checkout@v4
55 with:
56 fetch-depth: 0
57 ref: main
58
59 - name: Free Disk Space
60 uses: jlumbroso/free-disk-space@main
61 with:
62 # this might remove tools that are actually needed,
63 # if set to "true" but frees about 6 GB
64 tool-cache: false
65
66 # all of these default to true, but feel free to set to
67 # "false" if necessary for your workflow
68 android: true
69 dotnet: true
70 haskell: true
71 large-packages: true
72 docker-images: true
73 swap-storage: true
74
75 - name: Setup Deterinate Nix
76 uses: DeterminateSystems/nix-installer-action@main
77 with:
78 determinate: true
79
80 - name: Show flake metadata
81 run: nix flake metadata
82
83 - name: Prep dist dir
84 run: mkdir dist
85
86 - name: Build custom live ISO
87 run: |
88 set -xe
89
90 echo ::group::Build log
91 nix build .#live-cd -vv --show-trace
92 echo ::endgroup::
93
94 echo ::group::Post-build inspection
95 echo "${PWD}/result:"
96 ls -Al result
97
98 echo "${PWD}/result/iso:"
99 ls -Al result/iso
100 echo ::endgroup::
101
102 # temporary hackaround for permission errors
103 sudo cp result/iso/*.iso ./dist/ -rv
104
105 - name: Fix perms before deployment
106 run: sudo chown -Rv $(id -u):$(id -g) dist/*.iso && chmod -Rv 644 dist/*.iso
107
108 - name: Upload as artifact
109 uses: actions/upload-artifact@v4
110 with:
111 name: nixos-custom-iso
112 path: dist
113 build-raspi-sdimg:
114 concurrency:
115 cancel-in-progress: false
116 group: raspi-sd-img-builds
117 needs: [update-lockfile]
118 name: Build custom Raspberry Pi SD image
119 runs-on: ubuntu-latest
120 env:
121 PREBUILD_TAG: build-1743088286
122 steps:
123 - uses: actions/checkout@v4
124 with:
125 fetch-depth: 0
126 ref: main
127
128 - name: Free Disk Space
129 uses: jlumbroso/free-disk-space@main
130 with:
131 # this might remove tools that are actually needed,
132 # if set to "true" but frees about 6 GB
133 tool-cache: false
134
135 # all of these default to true, but feel free to set to
136 # "false" if necessary for your workflow
137 android: true
138 dotnet: true
139 haskell: true
140 large-packages: true
141 docker-images: true
142 swap-storage: true
143
144 - name: Setup Deterinate Nix
145 uses: DeterminateSystems/nix-installer-action@main
146 with:
147 determinate: true
148
149 - name: Show flake metadata
150 run: nix flake metadata
151
152 # https://github.com/docker/setup-qemu-action
153 - name: Set up QEMU
154 uses: docker/setup-qemu-action@v3
155
156 # https://github.com/docker/setup-buildx-action
157 - name: Set up Docker Buildx
158 id: buildx
159 uses: docker/setup-buildx-action@v1
160
161 - name: Prepare build environment
162 run: |
163 docker pull ghcr.io/andreijiroh-dev/nixops-config/rpi-sd-imager:${{env.PREBUILD_TAG}}
164 docker tag ghcr.io/andreijiroh-dev/nixops-config/rpi-sd-imager:${{env.PREBUILD_TAG}} ghcr.io/andreijiroh-dev/nixops-config/rpi-sd-imager:dev
165
166 - name: Build the SD image
167 run: cd hosts/raspi-base && docker compose up
168
169 - name: Upload as artifact
170 uses: actions/upload-artifact@v4
171 with:
172 name: nixos-raspi-sd-img
173 path: hosts/raspi-base/output