Skip to content

feat(libstore): curl-based s3#13752

Merged
xokdvium merged 5 commits intoNixOS:masterfrom
lovesegfault:curl-based-s3-v2
Oct 15, 2025
Merged

feat(libstore): curl-based s3#13752
xokdvium merged 5 commits intoNixOS:masterfrom
lovesegfault:curl-based-s3-v2

Conversation

@lovesegfault
Copy link
Copy Markdown
Member

@lovesegfault lovesegfault commented Aug 14, 2025

Motivation

#13084

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@xokdvium
Copy link
Copy Markdown
Contributor

Would it be conceivable to just outright replace aws-sdk-cpp with this? I don't think we'd want to support it if we land this eventually.

@lovesegfault
Copy link
Copy Markdown
Member Author

I was unsure about just removing the existing implementation outright, but I can do that if folks are OK with it?

@xokdvium
Copy link
Copy Markdown
Contributor

but I can do that if folks are OK with it?

Can't speak for everyone, but I feel ripping out aws-sdk-cpp would be very welcome if the new thing is more lightweight and reuses the curl infrastructure with feature parity. That would definitely be better than supporting both implementations.

@lovesegfault
Copy link
Copy Markdown
Member Author

@xokdvium I'm going to get this in a fully working state, and after I'm happy with it I'll tack on a final commit removing the old impl, so if there's tension we can discuss that point separately, or I can make it a separate PR, etc.

I'm with you that if this works well, we're better off just tossing the old impl, though that would mean folks building with old curl would lose the ability to talk to s3, but idk if we care to support people building non-standard configurations like that.

@github-actions github-actions bot added the store Issues and pull requests concerning the Nix store label Aug 14, 2025
@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 2 times, most recently from 2030275 to 86873ed Compare August 14, 2025 23:40
@Mic92
Copy link
Copy Markdown
Member

Mic92 commented Aug 15, 2025

I want to definitely test this with our hydra staging instance to ensure it still can upload stuff to s3 buckets before merging.

@lovesegfault
Copy link
Copy Markdown
Member Author

AFAICT this is ready for (very) preliminary testing; at least I was able to pull and push to an S3 store and auth just worked, like magic :)

@lovesegfault
Copy link
Copy Markdown
Member Author

Nevermind, I messed something up, buckets outside of us-east-1 don't work :P

@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 3 times, most recently from aefcffd to 3433232 Compare August 15, 2025 20:33
@lovesegfault lovesegfault force-pushed the curl-based-s3-v2 branch 3 times, most recently from 2dd60ad to 80e3327 Compare August 17, 2025 04:17
@lovesegfault lovesegfault marked this pull request as ready for review August 17, 2025 04:37
@lovesegfault lovesegfault requested review from Mic92 and xokdvium August 17, 2025 04:37
Copy link
Copy Markdown
Contributor

@xokdvium xokdvium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preliminary comments

rehank0678

This comment was marked as spam.

rehank0678

This comment was marked as spam.

This commit replaces the AWS C++ SDK with a lighter curl-based approach
for S3 binary cache operations.

- Removed dependency on the heavy aws-cpp-sdk-s3 and aws-cpp-sdk-transfer
- Added lightweight aws-crt-cpp for credential resolution only
- Leverages curl's native AWS SigV4 authentication (requires curl >= 7.75.0)
- S3BinaryCacheStore now delegates to HttpBinaryCacheStore
- Function s3ToHttpsUrl converts ParsedS3URL to ParsedURL
- Multipart uploads are no longer supported (may be reimplemented later)
- Build now requires curl >= 7.75.0 for AWS SigV4 support

Fixes: NixOS#13084, NixOS#12671, NixOS#11748, NixOS#12403, NixOS#5947
Now that the legacy S3 implementation is gone, we can go back to calling
things `NIX_WITH_S3_SUPPORT`.
Move S3 URL parsing, store configuration, and public bucket support
outside of NIX_WITH_S3_SUPPORT guards. Only AWS credential resolution
remains gated, allowing builds with withAWS = false to:

- Parse s3:// URLs
- Register S3 store types
- Access public S3 buckets (via HTTPS conversion)
- Use S3-compatible services without authentication

The setupForS3() function now always performs URL conversion, with
authentication code conditionally compiled based on NIX_WITH_S3_SUPPORT.
The aws-creds.cc file (only code using AWS CRT SDK) is now conditionally
compiled by meson.
The macro now accurately reflects its purpose: gating only AWS
authentication code, not all S3 functionality. S3 URL parsing, store
configuration, and public bucket access work regardless of this flag.

This rename clarifies that:
- S3 support is always available (URL parsing, store registration)
- Only AWS credential resolution requires the flag
- The flag controls AWS CRT SDK dependency, not S3 protocol support
@lovesegfault
Copy link
Copy Markdown
Member Author

giphy

@roberth
Copy link
Copy Markdown
Member

roberth commented Dec 5, 2025

@lovesegfault the prose doesn't seem to appear in the manual anymore. Could you look into that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants