Skip to content

Commit

Permalink
Update instructions for use_nixcached
Browse files Browse the repository at this point in the history
  • Loading branch information
zombiezen committed Nov 21, 2023
1 parent 20d643b commit 09d6cd4
Showing 1 changed file with 45 additions and 8 deletions.
53 changes: 45 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v16
uses: cachix/install-nix-action@v23
- name: Set up cache
uses: zombiezen/setup-nix-cache-action@v0.1.0
uses: zombiezen/setup-nix-cache-action@v0.3.0
with:
substituters: s3://example-bucket
secret_keys: ${{ secrets.NIX_PRIVATE_KEY }}
Expand All @@ -33,8 +33,7 @@ jobs:
run: nix-build
```
Using a [Google Cloud Storage][] bucket for loading and storing
with the [interoperability endpoint][]:
Using a [Google Cloud Storage][] bucket for loading and storing:
```yaml
name: Build
Expand All @@ -44,11 +43,43 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v16
uses: cachix/install-nix-action@v23
- name: Authenticate to Google Cloud Platform
# See https://github.com/google-github-actions/auth/blob/main/README.md
# for details on how to set up.
uses: google-github-actions/auth@v1
- name: Set up cache
uses: zombiezen/setup-nix-cache-action@v0.1.0
uses: zombiezen/setup-nix-cache-action@v0.3.0
with:
substituters: gs://example-bucket
secret_keys: ${{ secrets.NIX_PRIVATE_KEY }}
use_nixcached: true
- name: Build
run: nix-build
```
The example above uses [nixcached][] to connect to Google Cloud Storage
using normal service account credentials.
If you prefer to avoid the dependency, you can instead use the [interoperability endpoint][],
but you will have to generate an HMAC key:
```yaml
# Connecting to GCS without nixcached (not recommended).

name: Build
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v23
- name: Set up cache
uses: zombiezen/setup-nix-cache-action@v0.3.0
with:
substituters: s3://example-bucket?endpoint=https://storage.googleapis.com
secret_keys: ${{ secrets.NIX_PRIVATE_KEY }}
Expand All @@ -61,6 +92,7 @@ jobs:
[Amazon Web Services S3]: https://aws.amazon.com/s3/
[Google Cloud Storage]: https://cloud.google.com/storage
[interoperability endpoint]: https://cloud.google.com/storage/docs/interoperability
[nixcached]: https://github.com/zombiezen/nixcached
## Inputs
Expand All @@ -86,6 +118,11 @@ Access key ID for downloading and uploading artifacts

Secret access key for downloading and uploading artifacts

### `use_nixcached`

If `true`, use [nixcached][] for uploading and downloading.
This permits concurrent uploading and more straightforward authentication.

## License

[Apache 2.0](LICENSE)

0 comments on commit 09d6cd4

Please sign in to comment.