Manual caching
This commit is contained in:
parent
c04e0a8a9a
commit
4142d069a3
|
@ -13,6 +13,14 @@ jobs:
|
|||
uses: actions/checkout@v3.5.3
|
||||
with:
|
||||
ref: trunk
|
||||
|
||||
- name: "Cache Nix store"
|
||||
uses: actions/cache@v3.0.8
|
||||
id: nix-cache
|
||||
with:
|
||||
path: /tmp/nixcache
|
||||
key: "pi-nix-cache-v1"
|
||||
|
||||
- name: Install prerequisites
|
||||
run: apt update && apt install -y sudo zstd
|
||||
- name: Install Nix
|
||||
|
@ -23,8 +31,9 @@ jobs:
|
|||
- name: Remove access_tokens
|
||||
run: sed -i '/^access-tokens/d' /etc/nix/nix.conf
|
||||
|
||||
- name: Nix Magic Cache
|
||||
uses: https://github.com/DeterminateSystems/magic-nix-cache-action@main
|
||||
- name: "Import Nix store cache"
|
||||
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
||||
run: "nix-store --import < /tmp/nixcache"
|
||||
|
||||
- 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
|
||||
|
@ -34,3 +43,6 @@ jobs:
|
|||
name: nixos-pi-23.05-{{ env.GITHUB_SHA }}.img
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue