infra/.gitea/workflows/build-pi-img.yml
Gabriel Simmer faf73f12ce
Some checks reported warnings
Lint / lint (push) Successful in 9s
Build Pi NixOS Image / sync (push) Has been cancelled
Upgrade cache version
2023-08-15 18:35:24 +01:00

52 lines
1.5 KiB
YAML

name: Build Pi NixOS Image
on:
push:
paths:
- 'pi-imgs/**'
- '.gitea/workflows/build-pi-img.yml'
jobs:
sync:
runs-on: debian-latest-arm
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3
with:
ref: trunk
- name: Install prerequisites
run: apt update && apt install -y sudo
- name: Install Nix
uses: https://github.com/cachix/install-nix-action@v22
with:
extra_nix_config: "experimental-features = nix-command flakes"
nix_path: nixpkgs=channel:nixos-23.05
- name: Remove access_tokens
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
- name: Cache Nix store
uses: actions/cache@v3.3.1
id: nix-cache
with:
path: /tmp/nixcache
key: "pi-build-cache"
- name: "Import Nix store cache"
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: "nix-store --import < /tmp/nixcache"
- name: "Build application"
run: "nix build --print-build-logs"
- name: Build image
run: nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./pi-imgs/pi-initial.nix --argstr system aarch64-linux
- name: Upload img file
uses: https://github.com/actions/upload-artifact@v3.1.2
with:
path: result/sd-image/*.img
- name: "Export Nix store cache"
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"