workflow: use new s3 nix cache
add cache priv and pub key add cache priv key to /home/runner workflow: use new cache for build-packages
This commit is contained in:
parent
aea2a217c2
commit
8c3f3a4dff
2 changed files with 17 additions and 27 deletions
29
.github/workflows/build-machines-and-homes.yml
vendored
29
.github/workflows/build-machines-and-homes.yml
vendored
|
@ -7,12 +7,15 @@ env:
|
||||||
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||||
NIX_CONFIG: |
|
NIX_CONFIG: |
|
||||||
show-trace = true
|
show-trace = true
|
||||||
extra-substituters = https://cdn.cy7.sh/main
|
|
||||||
extra-trusted-public-keys = main:Ku31HoEWcBtfggge2VGj+QTkVrQuIwRIMGyfV/5VQP0=
|
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
accept-flake-config = true
|
accept-flake-config = true
|
||||||
system-features = nixos-test benchmark big-parallel kvm
|
system-features = nixos-test benchmark big-parallel kvm
|
||||||
|
secret-key-files = /home/runner/cache-priv-key.pem
|
||||||
|
extra-substituters = https://nixcache.cy7.sh
|
||||||
|
extra-trusted-public-keys = nixcache.cy7.sh:DN3d1dt0wnXfTH03oVmTee4KgmdNdB0NY3SuzA8Fwx8=
|
||||||
TERM: ansi
|
TERM: ansi
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets. AWS_SECRET_ACCESS_KEY }}
|
||||||
jobs:
|
jobs:
|
||||||
build-machines:
|
build-machines:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -36,16 +39,14 @@ jobs:
|
||||||
remove-codeql: 'true'
|
remove-codeql: 'true'
|
||||||
remove-docker-images: 'true'
|
remove-docker-images: 'true'
|
||||||
build-mount-path: /nix
|
build-mount-path: /nix
|
||||||
|
- name: setup binary cache key
|
||||||
|
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v30
|
uses: cachix/install-nix-action@v30
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: setup attic
|
|
||||||
run: |
|
|
||||||
nix profile install github:zhaofengli/attic
|
|
||||||
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
|
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
|
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
|
||||||
|
@ -53,10 +54,7 @@ jobs:
|
||||||
- name: cache
|
- name: cache
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel"
|
nix copy ".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel" --to "s3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem"
|
||||||
derivation="$(nix path-info --derivation "$package")"
|
|
||||||
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
|
|
||||||
xargs attic push main <<< "$cache"
|
|
||||||
build-homes:
|
build-homes:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -80,16 +78,14 @@ jobs:
|
||||||
remove-codeql: 'true'
|
remove-codeql: 'true'
|
||||||
remove-docker-images: 'true'
|
remove-docker-images: 'true'
|
||||||
build-mount-path: /nix
|
build-mount-path: /nix
|
||||||
|
- name: setup binary cache key
|
||||||
|
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v30
|
uses: cachix/install-nix-action@v30
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: setup attic
|
|
||||||
run: |
|
|
||||||
nix profile install github:zhaofengli/attic
|
|
||||||
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
|
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
|
package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
|
||||||
|
@ -97,7 +93,4 @@ jobs:
|
||||||
- name: cache
|
- name: cache
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
package=".#homeConfigurations."${{ matrix.home }}".activationPackage"
|
nix copy ".#homeConfigurations."${{ matrix.home }}".activationPackage" --to "s3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem"
|
||||||
derivation="$(nix path-info --derivation "$package")"
|
|
||||||
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
|
|
||||||
xargs attic push main <<< "$cache"
|
|
||||||
|
|
15
.github/workflows/build-packages.yml
vendored
15
.github/workflows/build-packages.yml
vendored
|
@ -10,10 +10,11 @@ env:
|
||||||
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
||||||
NIX_CONFIG: |
|
NIX_CONFIG: |
|
||||||
show-trace = true
|
show-trace = true
|
||||||
extra-substituters = https://cdn.cy7.sh/main
|
|
||||||
extra-trusted-public-keys = main:Ku31HoEWcBtfggge2VGj+QTkVrQuIwRIMGyfV/5VQP0=
|
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
accept-flake-config = true
|
accept-flake-config = true
|
||||||
|
secret-key-files = /home/runner/cache-priv-key.pem
|
||||||
|
extra-substituters = https://nixcache.cy7.sh
|
||||||
|
extra-trusted-public-keys = nixcache.cy7.sh:DN3d1dt0wnXfTH03oVmTee4KgmdNdB0NY3SuzA8Fwx8=
|
||||||
TERM: ansi
|
TERM: ansi
|
||||||
jobs:
|
jobs:
|
||||||
build-packages:
|
build-packages:
|
||||||
|
@ -29,23 +30,19 @@ jobs:
|
||||||
- macos-13
|
- macos-13
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: setup binary cache key
|
||||||
|
run: echo "${{ secrets.NIX_CACHE_SECRET_KEY }}" >> /home/runner/cache-priv-key.pem
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v30
|
uses: cachix/install-nix-action@v30
|
||||||
- name: Sync repository
|
- name: Sync repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: setup attic
|
|
||||||
run: |
|
|
||||||
nix profile install github:zhaofengli/attic
|
|
||||||
attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN"
|
|
||||||
- run: nix build -L ${{ matrix.package }}
|
- run: nix build -L ${{ matrix.package }}
|
||||||
- name: cache result
|
- name: cache result
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
derivation="$(nix path-info --derivation "${{ matrix.package }}")"
|
nix copy "${{ matrix.machine }}" --to "s3://nixcache?endpoint=s3.cy7.sh&secret-key=/home/runner/cache-priv-key.pem"
|
||||||
cache="$(nix-store --query --requisites --include-outputs "$derivation")"
|
|
||||||
xargs attic push main <<< "$cache"
|
|
||||||
- name: prepare tarball to upload
|
- name: prepare tarball to upload
|
||||||
run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result
|
run: nix run github:nixos/nixpkgs#gnutar hcvf result.tar result
|
||||||
- name: upload result
|
- name: upload result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue