From 2ca9d7704bcc8ce6561393cfd0208396843ecf1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Mon, 16 Jan 2023 13:05:54 +0100 Subject: [PATCH] Upload things to attic --- .github/workflows/build.yml | 10 +++++++--- scripts/post-build-hook | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65ffbe4..c5b91bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,20 +68,24 @@ jobs: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs= cache:6tx18bfuH66LOfrn37EmN2YxwNZI3qNk3lKHoz/XlXI= experimental-features = nix-command flakes ca-derivations post-build-hook = ${{ github.workspace }}/scripts/post-build-hook - substituters = https://cache.chir.rs/ https://cache.nixos.org/ + substituters = https://cache.chir.rs/ https://cache.nixos.org/ https://attic.chir.rs/cache - name: Download patched nix run: nix build github:DarkKirb/nix-packages#nix-s3-dedup + - name: Download attic + run: nix build github:DarkKirb/nix-packages#attic-client - name: Set up secrets run: | echo "$NIX_CACHE_KEY" > ~/cache.key sudo mkdir /root/.aws echo "$AWS_CREDENTIALS" | sudo tee /root/.aws/credentials > /dev/null + nix run github:DarkKirb/nix-packages#attic-client -- login attic-server https://attic.chir.rs/ "$ATTIC_TOKEN" env: NIX_CACHE_KEY: ${{secrets.NIX_CACHE_KEY}} AWS_CREDENTIALS: ${{secrets.AWS_CREDENTIALS}} + ATTIC_TOKEN: ${{secrets.ATTIC_TOKEN}} - name: install jq run: sudo apt install jq - name: Build ${{ matrix.package }} @@ -93,7 +97,7 @@ jobs: if curl --output /dev/null --silent --fail "https://cache.chir.rs/$NARINFO.narinfo"; then echo "${{ matrix.package }} already built. Skipping" else - nix-store -r $DRV_PATH + sudo /nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#attic-client' -- push cache $(nix-store -r $DRV_PATH) fi env: NIXPKGS_ALLOW_UNFREE: 1 diff --git a/scripts/post-build-hook b/scripts/post-build-hook index b4b056e..ad828f5 100755 --- a/scripts/post-build-hook +++ b/scripts/post-build-hook @@ -2,4 +2,5 @@ set -euf export IFS=' ' /nix/var/nix/profiles/default/bin/nix store sign --key-file /home/runner/cache.key $DRV_PATH -/nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#nix-s3-dedup' -- copy --to 's3://cache-chir-rs?scheme=https&endpoint=s3.us-west-000.backblazeb2.com&secret-key=/home/runner/cache.key&multipart-upload=true&compression=zstd&compression-level=15' $DRV_PATH \ No newline at end of file +/nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#nix-s3-dedup' -- copy --to 's3://cache-chir-rs?scheme=https&endpoint=s3.us-west-000.backblazeb2.com&secret-key=/home/runner/cache.key&multipart-upload=true&compression=zstd&compression-level=15' $DRV_PATH +/nix/var/nix/profiles/default/bin/nix run 'github:DarkKirb/nix-packages#attic-client' -- push cache $OUT_PATHS