From 46c2eaf31178d86bd59c070af633f272e89a8372 Mon Sep 17 00:00:00 2001
From: NullBite <me@nullbite.com>
Date: Tue, 4 Feb 2025 04:34:33 -0500
Subject: [PATCH] add workflow to cache updated flake

---
 .github/workflows/proactive-update.yaml | 39 +++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 .github/workflows/proactive-update.yaml

diff --git a/.github/workflows/proactive-update.yaml b/.github/workflows/proactive-update.yaml
new file mode 100644
index 0000000..90838d1
--- /dev/null
+++ b/.github/workflows/proactive-update.yaml
@@ -0,0 +1,39 @@
+name: Proactively build and cache flake
+on:
+  schedule:
+    - cron: "0 3 * * *"
+
+jobs:
+  build_arm:
+    runs-on: ubuntu-24.04-arm
+    steps:
+      - uses: actions/checkout@v4
+      - uses: DeterminateSystems/nix-installer-action@main
+      - uses: DeterminateSystems/flake-checker-action@main
+      - uses: ryanccn/attic-action@v0
+        with:
+          endpoint: ${{ secrets.ATTIC_ENDPOINT }}
+          cache: ${{ secrets.ATTIC_CACHE }}
+          token: ${{ secrets.ATTIC_TOKEN }}
+      # free useless disk space
+      - run: 'curl https://raw.githubusercontent.com/apache/arrow/31747f067a6ae29eca2d9bc68748500a8163d83e/ci/scripts/util_free_space.sh | bash'
+      - run: 'nix flake update'
+      - run: 'nix build .#nixosConfigurations.rpi4.config.system.build.toplevel'
+
+  build_x86:
+    runs-on: ubuntu-24.04
+    steps:
+      - uses: actions/checkout@v4
+      - uses: DeterminateSystems/nix-installer-action@main
+      - uses: DeterminateSystems/flake-checker-action@main
+      - uses: ryanccn/attic-action@v0
+        with:
+          endpoint: ${{ secrets.ATTIC_ENDPOINT }}
+          cache: ${{ secrets.ATTIC_CACHE }}
+          token: ${{ secrets.ATTIC_TOKEN }}
+      # free useless disk space
+      - run: 'curl https://raw.githubusercontent.com/apache/arrow/31747f067a6ae29eca2d9bc68748500a8163d83e/ci/scripts/util_free_space.sh | bash'
+      - run: 'nix flake update'
+      - run: 'nix build .#nixosConfigurations.nullbox.config.system.build.toplevel'
+      - run: 'nix build .#nixosConfigurations.slab.config.system.build.toplevel'
+      - run: 'nix build .#nixosConfigurations.nixos-wsl.config.system.build.toplevel'