From 1537fd644418e4ae1b8e60c31d465076ee7bdfce Mon Sep 17 00:00:00 2001 From: cy Date: Fri, 28 Mar 2025 18:01:35 -0400 Subject: [PATCH] workflow: try yet another way to cache --- .../workflows/build-machines-and-homes.yml | 30 ++++++++++++++----- .github/workflows/build-packages.yml | 13 ++++++-- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-machines-and-homes.yml b/.github/workflows/build-machines-and-homes.yml index 1272cc1..f04d05f 100644 --- a/.github/workflows/build-machines-and-homes.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -70,12 +70,19 @@ jobs: nix build -L "$package" - name: cache - if: always() + # if: always() run: | package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel" - nix copy -j8 \ - --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ - $(nix path-info --recursive --derivation "$package" |sed 's/\.drv$/.drv^*/') + derivations=() + while IFS=$'\n' read derivation; do + derivations+=("$derivation") + done < <(nix path-info --derivation "$package") + + for derivation in "${derivations[@]}"; do + nix copy -j8 \ + --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ + $(nix-store --query --requisites --include-outputs "$derivation") + done build-homes: strategy: @@ -129,9 +136,16 @@ jobs: nix build -L "$package" - name: cache - if: always() + # if: always() run: | package=".#homeConfigurations."${{ matrix.home }}".activationPackage" - nix copy -j8 \ - --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ - $(nix path-info --recursive --derivation "$package" |sed 's/\.drv$/.drv^*/') + derivations=() + while IFS=$'\n' read derivation; do + derivations+=("$derivation") + done < <(nix path-info --derivation "$package") + + for derivation in "${derivations[@]}"; do + nix copy -j8 \ + --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ + $(nix-store --query --requisites --include-outputs "$derivation") + done diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index 637afbf..17e5637 100644 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -61,9 +61,16 @@ jobs: - name: cache result if: always() run: | - nix copy -j8 \ - --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ - $(nix path-info --recursive --derivation "${{ matrix.package }}" |sed 's/\.drv$/.drv^*/') + derivations=() + while IFS=$'\n' read derivation; do + derivations+=("$derivation") + done < <(nix path-info --derivation "${{ matrix.package }}") + + for derivation in "${derivations[@]}"; do + nix copy -j8 \ + --to 's3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem' \ + $(nix-store --query --requisites --include-outputs "$derivation") + done - name: prepare tarball to upload run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result