-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch nix cache solution because it was clunky
- Loading branch information
Showing
1 changed file
with
15 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,17 +22,21 @@ jobs: | |
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v26 | ||
uses: cachix/install-nix-action@v25 | ||
with: | ||
nix_path: nixpkgs=channel:nixpkgs-23.11-darwin | ||
|
||
- name: Cache Nix store | ||
uses: nix-community/[email protected] | ||
uses: actions/cache@v4 | ||
id: nix-cache | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('shell.nix') }} | ||
key: nix-${{ runner.os }}-${{ hashFiles('shell.nix') }} | ||
path: /tmp/nix-cache | ||
|
||
- name: Install Nix channels | ||
- name: Import Nix store cache | ||
if: ${{ steps.nix-cache.outputs.cache-hit == 'true' }} | ||
run: | | ||
nix-channel --add https://nixos.org/channels/nixpkgs-23.11-darwin nixpkgs | ||
nix-channel --update | ||
nix-store --import < /tmp/nix-cache | ||
- name: Cache Python packages | ||
uses: actions/cache@v4 | ||
|
@@ -44,6 +48,11 @@ jobs: | |
run: | | ||
nix-shell --pure --run true | ||
- name: Export Nix store cache | ||
if: ${{ steps.nix-cache.outputs.cache-hit == 'false' }} | ||
run: | | ||
nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache | ||
- name: Build container image | ||
run: | | ||
echo "IMAGE_PATH=$(nix-build --no-out-link)" >> $GITHUB_ENV | ||
|
@@ -64,10 +73,6 @@ jobs: | |
run: | | ||
scp "${{ env.IMAGE_PATH }}" remote:~ | ||
- name: Cleanup cache after Nix build | ||
run: | | ||
nix-store --delete "${{ env.IMAGE_PATH }}" | ||
- name: Deploy on remote | ||
run: | | ||
ssh remote <<\EOF | ||
|