From 379e2a095cf9d1f1fc3b1b1d98d1d5eccbd8e0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Wed, 25 Nov 2026 01:07:23 +0200 Subject: [PATCH 1/5] ci(nix): substitute build inputs from a blacksmith sticky disk Add a flake output, ciBuildInputs., that lists the direct build inputs of every derivation in checks and legacyPackages. A new workflow runs on push to develop, substitutes that list into a Nix store on a Blacksmith sticky disk, roots it, and garbage collects the rest. It is the only job that commits the disk, one run at a time per system. The Linux build and check jobs mount the disk read-only and use it as an extra substituter. Nix still checks signatures on every path, and a failed mount falls back to the S3 cache. Co-Authored-By: Claude Fable 5.2 --- .github/actions/install-nix/action.yml | 14 ++++++ .github/actions/install-nix/setup-nix.sh | 6 ++- .github/workflows/nix-ci-per-system.yml | 3 ++ .github/workflows/nix-store-disk.yml | 58 ++++++++++++++++++++++++ flake.nix | 1 + nix/ci-build-inputs.nix | 40 ++++++++++++++++ 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nix-store-disk.yml create mode 100644 nix/ci-build-inputs.nix diff --git a/.github/actions/install-nix/action.yml b/.github/actions/install-nix/action.yml index 7a5e80dc2a..4c4b833010 100644 --- a/.github/actions/install-nix/action.yml +++ b/.github/actions/install-nix/action.yml @@ -19,6 +19,10 @@ inputs: description: Install Nix in single-user mode, without the Nix daemon, even when systemd is running. Eval-heavy jobs run faster this way. required: false default: false + sticky-disk: + description: Blacksmith sticky disk holding a Nix store to substitute from, Linux only. One of none, read, or write. read discards changes at job end, write commits them when the job succeeds. + required: false + default: none runs: using: composite steps: @@ -49,6 +53,15 @@ runs: output-env-credentials: false role-duration-seconds: 7200 + - name: mount nix store disk + if: inputs.sticky-disk != 'none' && runner.os == 'Linux' + continue-on-error: ${{ inputs.sticky-disk == 'read' }} + uses: useblacksmith/stickydisk@v1.8.0 + with: + key: nix-store-${{ runner.arch }} + path: /mnt/nix-store-disk + commit: ${{ inputs.sticky-disk == 'write' }} + - name: setup nix shell: bash run: cd ${{ github.action_path }} && ./setup-nix.sh @@ -61,6 +74,7 @@ runs: NIX_SIGN_SECRET_KEY: ${{ inputs.nix-signing-key }} PUSH_TO_CACHE: ${{ steps.resolve-push-to-cache.outputs.value }} SINGLE_USER: ${{ inputs.single-user }} + STICKY_DISK: ${{ inputs.sticky-disk }} - name: verify nix in path shell: bash diff --git a/.github/actions/install-nix/setup-nix.sh b/.github/actions/install-nix/setup-nix.sh index 221c88b64d..024fe24fad 100755 --- a/.github/actions/install-nix/setup-nix.sh +++ b/.github/actions/install-nix/setup-nix.sh @@ -27,10 +27,14 @@ else fi maybesudo mkdir -p "$nixconfdir" +substituters=https://nix-postgres-artifacts.s3.amazonaws.com +if [[ ${STICKY_DISK:-none} == read && $daemon == --daemon && $(uname -s) == Linux ]]; then + substituters="local?root=/mnt/nix-store-disk $substituters" +fi cat >"$tmpdir/nix.conf" <<-EOF always-allow-substitutes = true extra-experimental-features = flakes nix-command - extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com + extra-substituters = $substituters extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= max-jobs = 5 EOF diff --git a/.github/workflows/nix-ci-per-system.yml b/.github/workflows/nix-ci-per-system.yml index 85f5f3380c..050f61839b 100644 --- a/.github/workflows/nix-ci-per-system.yml +++ b/.github/workflows/nix-ci-per-system.yml @@ -118,6 +118,7 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} + sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry @@ -147,6 +148,7 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} + sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry @@ -174,6 +176,7 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} + sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry diff --git a/.github/workflows/nix-store-disk.yml b/.github/workflows/nix-store-disk.yml new file mode 100644 index 0000000000..0338bd115d --- /dev/null +++ b/.github/workflows/nix-store-disk.yml @@ -0,0 +1,58 @@ +name: Nix store disk + +# Only this workflow commits the sticky disk that CI builds substitute from. +# Jobs elsewhere mount it read-only and discard their changes. + +on: + push: + branches: + - develop + workflow_dispatch: + +permissions: + contents: read + +jobs: + refresh: + name: Refresh ${{ matrix.system }} + strategy: + fail-fast: false + matrix: + include: + - system: x86_64-linux + runner: blacksmith-8vcpu-ubuntu-2404 + - system: aarch64-linux + runner: blacksmith-8vcpu-ubuntu-2404-arm + runs-on: ${{ matrix.runner }} + concurrency: + group: nix-store-disk-${{ matrix.system }} + cancel-in-progress: false + steps: + - name: Checkout Repo + uses: actions/checkout@v7.0.1 + + - name: Install nix + uses: $/.github/actions/install-nix + with: + sticky-disk: write + + - name: Substitute build inputs onto the disk + env: + SYSTEM: ${{ matrix.system }} + run: | + set -euo pipefail + store='local?root=/mnt/nix-store-disk' + roots=/mnt/nix-store-disk/nix/var/nix/gcroots/ci + nix=$(command -v nix) + + nix eval --json ".#ciBuildInputs.$SYSTEM" | jq -r '.[]' >"$RUNNER_TEMP/paths" + + sudo -H xargs --arg-file="$RUNNER_TEMP/paths" --no-run-if-empty \ + "$nix" build --store "$store" --max-jobs 0 --keep-going --no-link \ + || echo "::warning::some build inputs could not be substituted" + + sudo rm -rf "$roots" + sudo mkdir -p "$roots" + sudo xargs --arg-file="$RUNNER_TEMP/paths" ln --symbolic --target-directory="$roots" + sudo -H "$nix" store gc --store "$store" + df --human-readable /mnt/nix-store-disk diff --git a/flake.nix b/flake.nix index afbb66cd11..afaa6590a9 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,7 @@ imports = [ nix/apps.nix nix/checks.nix + nix/ci-build-inputs.nix nix/config.nix nix/devShells.nix nix/fmt.nix diff --git a/nix/ci-build-inputs.nix b/nix/ci-build-inputs.nix new file mode 100644 index 0000000000..fce8257b75 --- /dev/null +++ b/nix/ci-build-inputs.nix @@ -0,0 +1,40 @@ +{ + self, + lib, + config, + ... +}: +let + derivationsIn = + value: + if lib.isDerivation value then + [ value ] + else if lib.isAttrs value then + lib.concatMap derivationsIn (lib.attrValues value) + else + [ ]; + + # NixOS tests are lazy derivations, which hide drvAttrs. + buildAttrs = drv: drv.drvAttrs or drv.config.rawTestDerivation.drvAttrs or { }; + + directInputs = + drv: + lib.concatLists ( + lib.mapAttrsToList ( + path: context: + map (output: builtins.unsafeDiscardStringContext (import path).${output}.outPath) ( + context.outputs or [ ] + ) + ) (builtins.getContext (builtins.toJSON (buildAttrs drv))) + ); +in +{ + flake.ciBuildInputs = lib.genAttrs config.systems ( + system: + lib.unique ( + lib.concatMap directInputs ( + derivationsIn self.checks.${system} ++ derivationsIn self.legacyPackages.${system} + ) + ) + ); +} From 1b806207b0c38cd92557375880d976e7cf70d4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Wed, 25 Nov 2026 03:27:13 +0200 Subject: [PATCH 2/5] fix(ci): add stickydisk to the actions lockfile Jobs failed at setup with "lockfile missing pin for useblacksmith/stickydisk@v1.8.0". Every workflow that uses the install-nix action needs the pin. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/actions.lock | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 062fddc0d7..d7edc95a94 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -8,10 +8,12 @@ workflows: - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' - 'softprops/action-gh-release@v3.0.4' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/check-extension-versions.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-pull-request@v8.1.3' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/cleanup-stale-ec2.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' @@ -24,14 +26,17 @@ workflows: - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'softprops/action-gh-release@v3.0.4' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/cli-smoke-test.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'docker/setup-buildx-action@v4.4.1' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/docker-image-test.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'docker/setup-buildx-action@v4.4.1' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/dockerhub-release-matrix.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' @@ -40,6 +45,7 @@ workflows: - 'docker/build-push-action@v7.4.0' - 'docker/login-action@v4.8.0' - 'docker/setup-buildx-action@v4.4.1' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/integration-trigger.yml': [] '.github/workflows/manual-docker-release.yml': - 'actions/checkout@v7.0.1' @@ -49,6 +55,7 @@ workflows: - 'docker/build-push-action@v7.4.0' - 'docker/login-action@v4.8.0' - 'docker/setup-buildx-action@v4.4.1' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/mirror-postgrest.yml': - 'actions/checkout@v7.0.1' - 'mikefarah/yq@v4.54.3' @@ -66,11 +73,17 @@ workflows: - 'actions/download-artifact@v8.0.2' - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/nix-dependency-analysis.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-or-update-comment@v5.0.0' - 'peter-evans/find-comment@v4.0.0' + - 'useblacksmith/stickydisk@v1.8.0' + '.github/workflows/nix-store-disk.yml': + - 'actions/checkout@v7.0.1' + - 'aws-actions/configure-aws-credentials@v6.3.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/public-integration-doorbell.yml': [] '.github/workflows/publish-migrations-prod.yml': - 'actions/checkout@v7.0.1' @@ -82,38 +95,46 @@ workflows: - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/publish-nix-pgupgrade-scripts.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/qemu-image-build.yml': - 'actions/checkout@v7.0.1' - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/qemu-image-release.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' - 'aws-actions/amazon-ecr-login@v2.1.7' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/renovate-refresh-ansible-checksums.yml': - 'actions/checkout@v7.0.1' - 'actions/create-github-app-token@v3.3.0' - 'aws-actions/configure-aws-credentials@v6.3.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/testinfra-ami-build.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/update-flake-lock-non-critical.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-pull-request@v8.1.3' + - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/update-flake-lock.yml': - 'actions/checkout@v7.0.1' - 'actions/create-github-app-token@v3.3.0' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'determinatesystems/update-flake-lock@v29' + - 'useblacksmith/stickydisk@v1.8.0' dependencies: 'actions/checkout@v7.0.1': ref: 'v7.0.1' @@ -238,3 +259,8 @@ dependencies: commit: 'sha1-8a0cd651e5b2365bd640854a3fa5dfc70e4875f3' owner_id: 2242 repo_id: 204253808 + 'useblacksmith/stickydisk@v1.8.0': + ref: 'v1.8.0' + commit: 'sha1-61dac6a8aa5927f7d3343d9dbdc8153787d08a1c' + owner_id: 156274793 + repo_id: 899799214 From 60922d22fcb341e4d2029d06b62b8a636a81ba24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Wed, 25 Nov 2026 05:18:04 +0200 Subject: [PATCH 3/5] refactor(ci): mount the nix store disk in the workflows Move the sticky disk mount out of the install-nix action and into the three CI jobs and the writer. Only those two workflows now need the stickydisk pin in the actions lockfile. setup-nix.sh adds the disk as a substituter when the mount point exists. The writer owns the disk as the runner user, so it needs no sudo for Nix. Co-Authored-By: Claude Fable 5.2 --- .github/actions/install-nix/action.yml | 14 -------- .github/actions/install-nix/setup-nix.sh | 10 +++--- .github/workflows/actions.lock | 16 --------- .github/workflows/nix-ci-per-system.yml | 27 ++++++++++++-- .github/workflows/nix-store-disk.yml | 46 +++++++++++------------- nix/ci-build-inputs.nix | 14 +++----- 6 files changed, 54 insertions(+), 73 deletions(-) diff --git a/.github/actions/install-nix/action.yml b/.github/actions/install-nix/action.yml index 4c4b833010..7a5e80dc2a 100644 --- a/.github/actions/install-nix/action.yml +++ b/.github/actions/install-nix/action.yml @@ -19,10 +19,6 @@ inputs: description: Install Nix in single-user mode, without the Nix daemon, even when systemd is running. Eval-heavy jobs run faster this way. required: false default: false - sticky-disk: - description: Blacksmith sticky disk holding a Nix store to substitute from, Linux only. One of none, read, or write. read discards changes at job end, write commits them when the job succeeds. - required: false - default: none runs: using: composite steps: @@ -53,15 +49,6 @@ runs: output-env-credentials: false role-duration-seconds: 7200 - - name: mount nix store disk - if: inputs.sticky-disk != 'none' && runner.os == 'Linux' - continue-on-error: ${{ inputs.sticky-disk == 'read' }} - uses: useblacksmith/stickydisk@v1.8.0 - with: - key: nix-store-${{ runner.arch }} - path: /mnt/nix-store-disk - commit: ${{ inputs.sticky-disk == 'write' }} - - name: setup nix shell: bash run: cd ${{ github.action_path }} && ./setup-nix.sh @@ -74,7 +61,6 @@ runs: NIX_SIGN_SECRET_KEY: ${{ inputs.nix-signing-key }} PUSH_TO_CACHE: ${{ steps.resolve-push-to-cache.outputs.value }} SINGLE_USER: ${{ inputs.single-user }} - STICKY_DISK: ${{ inputs.sticky-disk }} - name: verify nix in path shell: bash diff --git a/.github/actions/install-nix/setup-nix.sh b/.github/actions/install-nix/setup-nix.sh index 024fe24fad..e3b05a9bde 100755 --- a/.github/actions/install-nix/setup-nix.sh +++ b/.github/actions/install-nix/setup-nix.sh @@ -27,18 +27,18 @@ else fi maybesudo mkdir -p "$nixconfdir" -substituters=https://nix-postgres-artifacts.s3.amazonaws.com -if [[ ${STICKY_DISK:-none} == read && $daemon == --daemon && $(uname -s) == Linux ]]; then - substituters="local?root=/mnt/nix-store-disk $substituters" -fi cat >"$tmpdir/nix.conf" <<-EOF always-allow-substitutes = true extra-experimental-features = flakes nix-command - extra-substituters = $substituters + extra-substituters = https://nix-postgres-artifacts.s3.amazonaws.com extra-trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= max-jobs = 5 EOF +if [[ -d /mnt/nix-store-disk ]]; then + echo 'extra-substituters = local?root=/mnt/nix-store-disk' >>"$tmpdir/nix.conf" +fi + if [[ -e /dev/kvm ]]; then sudo chown runner /dev/kvm sudo chmod 666 /dev/kvm diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index f4fa28ce52..6c810f73ca 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -8,12 +8,10 @@ workflows: - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' - 'softprops/action-gh-release@v3.0.4' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/check-extension-versions.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-pull-request@v8.1.3' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/cleanup-stale-ec2.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' @@ -26,17 +24,14 @@ workflows: - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'softprops/action-gh-release@v3.0.4' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/cli-smoke-test.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'docker/setup-buildx-action@v4.4.1' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/docker-image-test.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'docker/setup-buildx-action@v4.4.1' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/dockerhub-release-matrix.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' @@ -45,7 +40,6 @@ workflows: - 'docker/build-push-action@v7.4.0' - 'docker/login-action@v4.8.0' - 'docker/setup-buildx-action@v4.4.1' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/integration-trigger.yml': [] '.github/workflows/manual-docker-release.yml': - 'actions/checkout@v7.0.1' @@ -55,7 +49,6 @@ workflows: - 'docker/build-push-action@v7.4.0' - 'docker/login-action@v4.8.0' - 'docker/setup-buildx-action@v4.4.1' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/mirror-postgrest.yml': - 'actions/checkout@v7.0.1' - 'mikefarah/yq@v4.54.3' @@ -79,7 +72,6 @@ workflows: - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-or-update-comment@v5.0.0' - 'peter-evans/find-comment@v4.0.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/nix-store-disk.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' @@ -95,46 +87,38 @@ workflows: - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/publish-nix-pgupgrade-scripts.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/qemu-image-build.yml': - 'actions/checkout@v7.0.1' - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/qemu-image-release.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' - 'aws-actions/amazon-ecr-login@v2.1.7' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'slackapi/slack-github-action@v4.0.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/renovate-rehash.yml': - 'actions/checkout@v7.0.1' - 'actions/create-github-app-token@v3.3.0' - 'aws-actions/configure-aws-credentials@v6.3.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/testinfra-ami-build.yml': - 'actions/checkout@v7.0.1' - 'actions/download-artifact@v8.0.2' - 'actions/upload-artifact@v7.0.2' - 'aws-actions/configure-aws-credentials@v6.3.0' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/update-flake-lock-non-critical.yml': - 'actions/checkout@v7.0.1' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'peter-evans/create-pull-request@v8.1.3' - - 'useblacksmith/stickydisk@v1.8.0' '.github/workflows/update-flake-lock.yml': - 'actions/checkout@v7.0.1' - 'actions/create-github-app-token@v3.3.0' - 'aws-actions/configure-aws-credentials@v6.3.0' - 'determinatesystems/update-flake-lock@v29' - - 'useblacksmith/stickydisk@v1.8.0' dependencies: 'actions/checkout@v7.0.1': ref: 'v7.0.1' diff --git a/.github/workflows/nix-ci-per-system.yml b/.github/workflows/nix-ci-per-system.yml index 050f61839b..d02adb8fc1 100644 --- a/.github/workflows/nix-ci-per-system.yml +++ b/.github/workflows/nix-ci-per-system.yml @@ -111,6 +111,14 @@ jobs: - name: Checkout Repo if: ${{ matrix.attr != '' }} uses: actions/checkout@v7.0.1 + - name: Mount nix store disk + if: ${{ matrix.attr != '' && runner.os == 'Linux' }} + continue-on-error: true + uses: useblacksmith/stickydisk@v1.8.0 + with: + key: nix-store-${{ runner.arch }} + path: /mnt/nix-store-disk + commit: false - name: Install nix if: ${{ matrix.attr != '' }} uses: $/.github/actions/install-nix @@ -118,7 +126,6 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} - sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry @@ -141,6 +148,14 @@ jobs: - name: Checkout Repo if: ${{ matrix.attr != '' }} uses: actions/checkout@v7.0.1 + - name: Mount nix store disk + if: ${{ matrix.attr != '' && runner.os == 'Linux' }} + continue-on-error: true + uses: useblacksmith/stickydisk@v1.8.0 + with: + key: nix-store-${{ runner.arch }} + path: /mnt/nix-store-disk + commit: false - name: Install nix if: ${{ matrix.attr != '' }} uses: $/.github/actions/install-nix @@ -148,7 +163,6 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} - sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry @@ -169,6 +183,14 @@ jobs: - name: Checkout Repo if: ${{ matrix.attr != '' }} uses: actions/checkout@v7.0.1 + - name: Mount nix store disk + if: ${{ matrix.attr != '' && runner.os == 'Linux' }} + continue-on-error: true + uses: useblacksmith/stickydisk@v1.8.0 + with: + key: nix-store-${{ runner.arch }} + path: /mnt/nix-store-disk + commit: false - name: Install nix if: ${{ matrix.attr != '' }} uses: $/.github/actions/install-nix @@ -176,7 +198,6 @@ jobs: push-to-cache: true nix-signing-key: ${{ secrets.NIX_SIGN_SECRET_KEY }} role-to-assume: ${{ secrets.DEV_AWS_ROLE }} - sticky-disk: read - name: nix build if: ${{ matrix.attr != '' }} uses: $/.github/actions/nix-build-retry diff --git a/.github/workflows/nix-store-disk.yml b/.github/workflows/nix-store-disk.yml index 0338bd115d..e25c8aafab 100644 --- a/.github/workflows/nix-store-disk.yml +++ b/.github/workflows/nix-store-disk.yml @@ -1,7 +1,6 @@ name: Nix store disk -# Only this workflow commits the sticky disk that CI builds substitute from. -# Jobs elsewhere mount it read-only and discard their changes. +# The only workflow that commits the disk. CI jobs mount it with commit: false. on: push: @@ -14,45 +13,42 @@ permissions: jobs: refresh: - name: Refresh ${{ matrix.system }} strategy: fail-fast: false matrix: - include: - - system: x86_64-linux - runner: blacksmith-8vcpu-ubuntu-2404 - - system: aarch64-linux - runner: blacksmith-8vcpu-ubuntu-2404-arm + runner: [blacksmith-8vcpu-ubuntu-2404, blacksmith-8vcpu-ubuntu-2404-arm] runs-on: ${{ matrix.runner }} - concurrency: - group: nix-store-disk-${{ matrix.system }} - cancel-in-progress: false + concurrency: nix-store-disk-${{ matrix.runner }} steps: - name: Checkout Repo uses: actions/checkout@v7.0.1 - name: Install nix uses: $/.github/actions/install-nix + + - name: Mount nix store disk + uses: useblacksmith/stickydisk@v1.8.0 with: - sticky-disk: write + key: nix-store-${{ runner.arch }} + path: /mnt/nix-store-disk - name: Substitute build inputs onto the disk - env: - SYSTEM: ${{ matrix.system }} run: | set -euo pipefail - store='local?root=/mnt/nix-store-disk' - roots=/mnt/nix-store-disk/nix/var/nix/gcroots/ci - nix=$(command -v nix) + disk=/mnt/nix-store-disk + store="local?root=$disk" + roots=$disk/nix/var/nix/gcroots/ci + paths=$RUNNER_TEMP/paths + sudo chown "$(id -u)" "$disk" - nix eval --json ".#ciBuildInputs.$SYSTEM" | jq -r '.[]' >"$RUNNER_TEMP/paths" + nix eval --json ".#ciBuildInputs.$(nix config show system)" | jq --raw-output '.[]' >"$paths" - sudo -H xargs --arg-file="$RUNNER_TEMP/paths" --no-run-if-empty \ - "$nix" build --store "$store" --max-jobs 0 --keep-going --no-link \ + xargs --arg-file="$paths" --no-run-if-empty \ + nix build --store "$store" --max-jobs 0 --keep-going --no-link \ || echo "::warning::some build inputs could not be substituted" - sudo rm -rf "$roots" - sudo mkdir -p "$roots" - sudo xargs --arg-file="$RUNNER_TEMP/paths" ln --symbolic --target-directory="$roots" - sudo -H "$nix" store gc --store "$store" - df --human-readable /mnt/nix-store-disk + rm -rf "$roots" + mkdir -p "$roots" + xargs --arg-file="$paths" ln --symbolic --target-directory="$roots" + nix store gc --store "$store" + df --human-readable "$disk" diff --git a/nix/ci-build-inputs.nix b/nix/ci-build-inputs.nix index fce8257b75..f5c54548ed 100644 --- a/nix/ci-build-inputs.nix +++ b/nix/ci-build-inputs.nix @@ -5,15 +5,6 @@ ... }: let - derivationsIn = - value: - if lib.isDerivation value then - [ value ] - else if lib.isAttrs value then - lib.concatMap derivationsIn (lib.attrValues value) - else - [ ]; - # NixOS tests are lazy derivations, which hide drvAttrs. buildAttrs = drv: drv.drvAttrs or drv.config.rawTestDerivation.drvAttrs or { }; @@ -33,7 +24,10 @@ in system: lib.unique ( lib.concatMap directInputs ( - derivationsIn self.checks.${system} ++ derivationsIn self.legacyPackages.${system} + lib.concatMap (lib.collect lib.isDerivation) [ + self.checks.${system} + self.legacyPackages.${system} + ] ) ) ); From 67904a722dd54e6d7919fd5a2ef41517a82113d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Wed, 25 Nov 2026 05:18:04 +0200 Subject: [PATCH 4/5] ci: seed the nix store disk from this branch Temporary. Remove the branch from the push trigger before merge. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/nix-store-disk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nix-store-disk.yml b/.github/workflows/nix-store-disk.yml index e25c8aafab..b5563929f4 100644 --- a/.github/workflows/nix-store-disk.yml +++ b/.github/workflows/nix-store-disk.yml @@ -6,6 +6,7 @@ on: push: branches: - develop + - ci/nix-store-sticky-disk workflow_dispatch: permissions: From 54e47d12df526ba96e00d208fb894945e4e62f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Thu, 26 Nov 2026 05:31:04 +0200 Subject: [PATCH 5/5] ci: stop running the nix store disk writer on this branch Blacksmith only lets the default branch commit a sticky disk, so the branch trigger cannot seed it. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/nix-store-disk.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nix-store-disk.yml b/.github/workflows/nix-store-disk.yml index b5563929f4..e25c8aafab 100644 --- a/.github/workflows/nix-store-disk.yml +++ b/.github/workflows/nix-store-disk.yml @@ -6,7 +6,6 @@ on: push: branches: - develop - - ci/nix-store-sticky-disk workflow_dispatch: permissions: