diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7b0d47f..a573fe7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -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/cache-nix-action@v5.0.1 + 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