cachix / install-nix-action

Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.
Apache License 2.0
517 stars 79 forks source link

using an s3 cache #212

Closed dbarrosop closed 2 weeks ago

dbarrosop commented 2 weeks ago

Hello, I am migrating over from https://github.com/nixbuild/nix-quick-install-action and I am having some minor issues due to an s3 cache. Before I had:

    - name: Configure aws
      uses: aws-actions/configure-aws-credentials@v4
      with:
        role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-nhost-${{ github.event.repository.name }}
        aws-region: eu-central-1

    - uses: nixbuild/nix-quick-install-action@v28
      with:
        nix_version: 2.20.5
        nix_conf: |
          experimental-features = nix-command flakes
          sandbox = false
          access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
          substituters = https://cache.nixos.org/?priority=40 s3://nix-cache?region=eu-central-1&priority=50
          trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{ secrets.NIX_CACHE_PUB_KEY }}

and I could successfully use the cache in s3. Now I changed it to:

    - name: Configure aws
      uses: aws-actions/configure-aws-credentials@v4
      with:
        role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-nhost-${{ github.event.repository.name }}
        aws-region: eu-central-1

    - uses: cachix/install-nix-action@v27
      with:
        install_url: "https://releases.nixos.org/nix/nix-2.24.1/install"
        install_options: "--no-daemon"
        extra_nix_config: |
          experimental-features = nix-command flakes
          sandbox = false
          access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
          substituters = https://cache.nixos.org/?priority=40 s3://nix-cache?region=eu-central-1&priority=50
          trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{ secrets.NIX_CACHE_PUB_KEY }}

But now it fails to access the cache in s3:

error: AWS error fetching 'nix-cache-info': The specified bucket does not exist

Is anyone using a cache in s3 that may know how to solve it?

Thanks!

sandydoo commented 2 weeks ago

@dbarrosop, the only thing that stands out is that you're comparing two different versions of Nix. Otherwise, the config seems fine to me.

To rule out issues with the action itself, try echo-ing nix show-config in the run and check that the output matches what you expect.

dbarrosop commented 2 weeks ago

Yes, closing it because I tried with 2.22.3 and it worked so must be something in 2.24. I will try to dig a bit further or ask on discourse. Thanks!